Springsecurity+jwt整合
1、自定义一个过滤器tokenFilter,用来处理请求中的token信息
2、自定义两个异常过滤器:JwtAuthenticationEntryPoint(身份认证异常),JwtAccessDeniedHandler(权限异常)
3、自定义安全配置 SecurityConfig,配置全局的请求过滤规则
4、自定义注解 AnonymousAccess,配置单独的匿名访问接口
5、自定义实现类 UserDetailsService 和 UserDetails,用于实现springSecurity的自定义身份认证
用户登录的前端密码是经过 rsa 公钥加密之后传到后台,后台用 私钥 进行解密
Spring Security 默认的密码加密方式是 bcrypt,将明文密码加密之后再保存到数据库
AuthenticationManager.authenticate(authenticationToken) 这个spring的用户认证方法,会调用我们自定义的 UserDetailsService 的 loadUserByUsername 方法,对用户进行认证;
UsernamePasswordAuthenticationFilter 默认的过滤路径是 /login
待学习:
@CacheConfig
@Cacheable
@CacheEvict
@PreAuthorize(“hasAnyAuthority(‘user:list’)”) 定义接口