https://github.com/svlada/springboot-security-jwt
spring security jwt
流程梳理
1. WebSecurityConfig
配置哪里url需要拦截,哪些url需要登录和token 认证;
加入ajax和token过滤器;
2. 当一个请求过来的时候filter进行拦截,过滤器进行ajax 和token 拦截进行认证;
3. 首先 AbstractAuthenticationProcessingFilter#doFilter 进行拦截,
@Configuration
public class PasswordConfig {
@Bean
protected BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
protected BASE64Decoder base64Decoder(){
return new BASE64Decoder();
}
}