Joyen.fu
日中则昃,月盈则食。

UsernamePasswordAuthenticationFilter用户登录验证过滤器,它继承自AbstractAuthenticationProcessingFilter。

登录处理url默认使用/j_spring_security_check,如果用户请求地址不是要进行用户验证的地址,则不使用这个过滤器拦截处理。用户登录验证则有可能交给rememberMeAuthenticationFilter。

同时提供授权成功处理器AuthenticationSuccessHandler和授权失败处理器AuthenticationFailureHandler

登录认证成功后如果需要rememberme则调用rememberMeServices记录cookie。

然后使用DefaultRedirectStrategy进行URL转发。response.sendRedirect(redirectUrl);调用onResponseCommitted()方法,继而调用saveContext()向session中保存SecurityContext

ResponseWrapper的类图关系

下图大致描述用户登录验证的过程。

主要用于负责认证管理的类:

AuthenticationManager 主体认证管理接口。

ProviderManager 主体认证提供者管理类,实现了AuthenticationManager。持有AuthenticationProvider对象。

AuthenticationProvider 主体认证提供者。

 

posted on 2016-03-28 15:10  Joyen.fu  阅读(1223)  评论(0编辑  收藏  举报