Commit 88aebd82 authored by maliang's avatar maliang

data

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