Spring Security JWT
首先需要创建2个过滤器. JwtLoginFilter 和 JwtAuthenticationFilter . JwtLoginFilter 用来处理用户登录请求. JwtAuthenticationFilter 用来处理JwtToken的验证解析. /** * @author: 阮胜 * @date: 2018/7/10 8:42 */ public class JwtLoginFilter extends AbstractAuthenticationProcessingFilter { private static final String POST = "POST"; private AuthenticationSuccessHandler successHandler = new JwtLoginSucessHandler(); private AuthenticationFailureHandler failureHandler = new JwtLoginFailureHandler(); public JwtLoginFilter(AuthenticationManager authenticationManager) { super(new AntPathRequestMatcher("/user/login", "POST"));