Commit 88aebd82 authored by maliang's avatar maliang

data

parent 5a6e867f
...@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
/** /**
* 启动类 * 启动类
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
@SpringBootApplication @SpringBootApplication
......
...@@ -17,7 +17,7 @@ import com.boot.security.server.dto.ResponseInfo; ...@@ -17,7 +17,7 @@ import com.boot.security.server.dto.ResponseInfo;
/** /**
* springmvc异常处理 * springmvc异常处理
* *
* @author 398005446@qq.com * @author maliang
* *
*/ */
@RestControllerAdvice @RestControllerAdvice
......
...@@ -9,7 +9,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; ...@@ -9,7 +9,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
/** /**
* 线程池配置、启用异步 * 线程池配置、启用异步
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
* 2017年8月19日 * 2017年8月19日
*/ */
......
...@@ -56,7 +56,7 @@ public class DruidConfig { ...@@ -56,7 +56,7 @@ public class DruidConfig {
/** /**
* 数据源配置 * 数据源配置
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
@ConfigurationProperties(prefix = "spring.datasource") @ConfigurationProperties(prefix = "spring.datasource")
......
...@@ -13,7 +13,7 @@ import org.springframework.data.redis.serializer.GenericToStringSerializer; ...@@ -13,7 +13,7 @@ import org.springframework.data.redis.serializer.GenericToStringSerializer;
* 集群下启动session共享,需打开@EnableRedisHttpSession<br> * 集群下启动session共享,需打开@EnableRedisHttpSession<br>
* 单机下不需要 * 单机下不需要
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
* 2017年8月10日 * 2017年8月10日
*/ */
......
...@@ -20,7 +20,7 @@ import com.boot.security.server.filter.TokenFilter; ...@@ -20,7 +20,7 @@ import com.boot.security.server.filter.TokenFilter;
/** /**
* spring security配置 * spring security配置
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
* 2017年10月16日 * 2017年10月16日
* *
...@@ -52,12 +52,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -52,12 +52,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 基于token,所以不需要session // 基于token,所以不需要session
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
//对这些类型请求直接放开不做拦截
http.authorizeRequests() http.authorizeRequests()
.antMatchers("/", "/*.html", "/favicon.ico", "/css/**", "/js/**", "/fonts/**", "/layui/**", "/img/**", .antMatchers("/", "/*.html", "/favicon.ico", "/css/**", "/js/**", "/fonts/**", "/layui/**", "/img/**",
"/v2/api-docs/**", "/swagger-resources/**", "/webjars/**", "/pages/**", "/druid/**", "/v2/api-docs/**", "/swagger-resources/**", "/webjars/**", "/pages/**", "/druid/**",
"/statics/**") "/statics/**")
.permitAll().anyRequest().authenticated(); .permitAll().anyRequest().authenticated();
//对于登录的地址和处理方法
http.formLogin().loginProcessingUrl("/login") http.formLogin().loginProcessingUrl("/login")
.successHandler(authenticationSuccessHandler).failureHandler(authenticationFailureHandler).and() .successHandler(authenticationSuccessHandler).failureHandler(authenticationFailureHandler).and()
.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint); .exceptionHandling().authenticationEntryPoint(authenticationEntryPoint);
...@@ -65,12 +66,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -65,12 +66,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 解决不允许显示在iframe的问题 // 解决不允许显示在iframe的问题
http.headers().frameOptions().disable(); http.headers().frameOptions().disable();
http.headers().cacheControl(); http.headers().cacheControl();
//对请求进行处理(给token续命并且把当前用户保存到security的上下文环境中)
http.addFilterBefore(tokenFilter, UsernamePasswordAuthenticationFilter.class); http.addFilterBefore(tokenFilter, UsernamePasswordAuthenticationFilter.class);
} }
@Override @Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception { protected void configure(AuthenticationManagerBuilder auth) throws Exception {
//实现UserDetailsService接口,security会调用其中方法创建登陆对象,并且获取对象拥有的权限
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
} }
......
...@@ -28,7 +28,7 @@ import com.boot.security.server.utils.ResponseUtil; ...@@ -28,7 +28,7 @@ import com.boot.security.server.utils.ResponseUtil;
/** /**
* spring security处理器 * spring security处理器
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
* 2017年10月16日 * 2017年10月16日
*/ */
......
...@@ -17,7 +17,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -17,7 +17,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
/** /**
* swagger文档 * swagger文档
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
* 2017年7月21日 * 2017年7月21日
*/ */
......
...@@ -22,7 +22,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -22,7 +22,7 @@ import io.swagger.annotations.ApiOperation;
/** /**
* 代码生成接口 * 代码生成接口
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
@Api(tags = "代码生成") @Api(tags = "代码生成")
......
...@@ -34,7 +34,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -34,7 +34,7 @@ import io.swagger.annotations.ApiOperation;
/** /**
* 权限相关接口 * 权限相关接口
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
@Api(tags = "权限") @Api(tags = "权限")
......
...@@ -30,7 +30,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -30,7 +30,7 @@ import io.swagger.annotations.ApiOperation;
/** /**
* 角色相关接口 * 角色相关接口
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
@Api(tags = "角色") @Api(tags = "角色")
......
...@@ -33,7 +33,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -33,7 +33,7 @@ import io.swagger.annotations.ApiOperation;
/** /**
* 用户相关接口 * 用户相关接口
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
@Api(tags = "用户") @Api(tags = "用户")
......
...@@ -5,7 +5,7 @@ import java.io.Serializable; ...@@ -5,7 +5,7 @@ import java.io.Serializable;
/** /**
* Restful方式登陆token * Restful方式登陆token
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
* 2017年8月4日 * 2017年8月4日
*/ */
......
...@@ -21,7 +21,7 @@ import com.boot.security.server.service.TokenService; ...@@ -21,7 +21,7 @@ import com.boot.security.server.service.TokenService;
/** /**
* Token过滤器 * Token过滤器
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
* 2017年10月14日 * 2017年10月14日
*/ */
...@@ -36,6 +36,7 @@ public class TokenFilter extends OncePerRequestFilter { ...@@ -36,6 +36,7 @@ public class TokenFilter extends OncePerRequestFilter {
private UserDetailsService userDetailsService; private UserDetailsService userDetailsService;
private static final Long MINUTES_10 = 10 * 60 * 1000L; private static final Long MINUTES_10 = 10 * 60 * 1000L;
//给token延长时间并且保存登录用户的信息
@Override @Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException { throws ServletException, IOException {
......
...@@ -19,7 +19,7 @@ import com.google.common.collect.Maps; ...@@ -19,7 +19,7 @@ import com.google.common.collect.Maps;
/** /**
* 分页、查询参数解析 * 分页、查询参数解析
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
public class PageTableArgumentResolver implements HandlerMethodArgumentResolver { public class PageTableArgumentResolver implements HandlerMethodArgumentResolver {
......
...@@ -6,7 +6,7 @@ import java.util.List; ...@@ -6,7 +6,7 @@ import java.util.List;
/** /**
* 分页查询处理器 * 分页查询处理器
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
......
...@@ -6,7 +6,7 @@ import java.util.Map; ...@@ -6,7 +6,7 @@ import java.util.Map;
/** /**
* 分页查询参数 * 分页查询参数
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
public class PageTableRequest implements Serializable { public class PageTableRequest implements Serializable {
......
...@@ -6,7 +6,7 @@ import java.util.List; ...@@ -6,7 +6,7 @@ import java.util.List;
/** /**
* 分页查询返回 * 分页查询返回
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
public class PageTableResponse implements Serializable { public class PageTableResponse implements Serializable {
......
...@@ -5,7 +5,7 @@ import com.boot.security.server.model.SysLogs; ...@@ -5,7 +5,7 @@ import com.boot.security.server.model.SysLogs;
/** /**
* 日志service * 日志service
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
* 2017年8月19日 * 2017年8月19日
*/ */
......
...@@ -11,7 +11,7 @@ import com.boot.security.server.dto.Token; ...@@ -11,7 +11,7 @@ import com.boot.security.server.dto.Token;
* 如要换成数据库存储,将TokenServiceImpl类上的注解@Primary挪到com.boot.security.server.service.impl.TokenServiceDbImpl * 如要换成数据库存储,将TokenServiceImpl类上的注解@Primary挪到com.boot.security.server.service.impl.TokenServiceDbImpl
* *
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
* 2017年10月14日 * 2017年10月14日
*/ */
......
...@@ -32,7 +32,7 @@ import io.jsonwebtoken.SignatureAlgorithm; ...@@ -32,7 +32,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
/** /**
* token存到数据库的实现类 * token存到数据库的实现类
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
@Service @Service
......
...@@ -16,7 +16,7 @@ import com.boot.security.server.service.TokenService; ...@@ -16,7 +16,7 @@ import com.boot.security.server.service.TokenService;
* token存到redis的实现类<br> * token存到redis的实现类<br>
* 普通token,uuid * 普通token,uuid
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
@Deprecated @Deprecated
......
...@@ -32,7 +32,7 @@ import io.jsonwebtoken.SignatureAlgorithm; ...@@ -32,7 +32,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
* token存到redis的实现类<br> * token存到redis的实现类<br>
* jwt实现的token * jwt实现的token
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
@Primary @Primary
......
...@@ -24,7 +24,7 @@ import com.boot.security.server.service.UserService; ...@@ -24,7 +24,7 @@ import com.boot.security.server.service.UserService;
* <p> * <p>
* 密码校验请看文档(02 框架及配置),第三章第4节 * 密码校验请看文档(02 框架及配置),第三章第4节
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
*/ */
@Service @Service
public class UserDetailsServiceImpl implements UserDetailsService { public class UserDetailsServiceImpl implements UserDetailsService {
......
...@@ -21,7 +21,7 @@ import org.apache.poi.ss.usermodel.Workbook; ...@@ -21,7 +21,7 @@ import org.apache.poi.ss.usermodel.Workbook;
/** /**
* excel工具类 * excel工具类
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
public class ExcelUtil { public class ExcelUtil {
......
...@@ -16,7 +16,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -16,7 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
/** /**
* 文件工具类 * 文件工具类
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
public class FileUtil { public class FileUtil {
......
...@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component; ...@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
/** /**
* spring获取bean工具类 * spring获取bean工具类
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
@Component @Component
......
...@@ -7,7 +7,7 @@ import com.google.common.collect.Lists; ...@@ -7,7 +7,7 @@ import com.google.common.collect.Lists;
/** /**
* 字符串转化工具类 * 字符串转化工具类
* *
* @author 奇趣源码商城 www.qiqucode.com * @author maliang
* *
*/ */
public class StrUtil { public class StrUtil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment