天天看点

SpringBoot Security jwt 登录认证流程(10)

1. security 默认流程图(基于session)

SpringBoot Security jwt 登录认证流程(10)
CustomAccessDecisionManager implements AccessDecisionManager 
           
CustomAccessDeniedHandler implements AccessDeniedHandler
           
CustomAuthenticationDetailsSource implements AuthenticationDetailsSource<HttpServletRequest, CustomAuthDetails> 
           
CustomAuthenticationEntryPoint implements AuthenticationEntryPoint 
           
CustomFilterInvocationSecurityMetadataSource implements FilterInvocationSecurityMetadataSource
           

2.基于jwt security的流程认证

在上述流程基础上添加jwttoken的拦截器 添加到登录认证之前  获取登录时候的Authorization解析出其中的用户名 查看token中的过期时间认证通过则登录(token保存到redis中) 没有token则直接进行security的登录认证