本文整理汇总了Java中org.springframework.security.web.authentication.AuthenticationFailureHandler类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationFailureHandler类的具体用法?Java AuthenticationFailureHandler怎么用?Java AuthenticationFailureHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationFailureHandler类属于org.springframework.security.web.authentication包,在下文中一共展示了AuthenticationFailureHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: failureLogin
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
public AuthenticationFailureHandler failureLogin(){
AuthenticationFailureHandler handler = new AuthenticationFailureHandler() {
@Override
public void onAuthenticationFailure(HttpServletRequest arg0,
HttpServletResponse arg1, AuthenticationException arg2)
throws IOException, ServletException {
System.out.println("SecurityConfig.failureLogin()#httpservletrequest\n"
+ ReflectionToStringBuilder.toString(arg0, ToStringStyle.SIMPLE_STYLE)
+ "\n----------------"
+ "\ngetQueryString: " + arg0.getQueryString()
+ "\ngetRequestURI: " + arg0.getRequestURI()
+ "\ngetServletPath: " + arg0.getServletPath()
+ "\ngetRequestURL: " + arg0.getRequestURL()
+ "\n\n"
);
arg1.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
arg1.sendRedirect("login");
}
};
return handler;
}
示例2: authenticationFailureHandler
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
@Bean
public AuthenticationFailureHandler authenticationFailureHandler() {
ExceptionMappingAuthenticationFailureHandler failureHandler = new ExceptionMappingAuthenticationFailureHandler();
Map<String, String> failureUrlMap = new HashMap<>();
failureUrlMap.put(BadCredentialsException.class.getName(), LoginAuthenticationFailureHandler.PASS_ERROR_URL);
failureUrlMap.put(CaptchaException.class.getName(), LoginAuthenticationFailureHandler.CODE_ERROR_URL);
failureUrlMap.put(AccountExpiredException.class.getName(), LoginAuthenticationFailureHandler.EXPIRED_URL);
failureUrlMap.put(LockedException.class.getName(), LoginAuthenticationFailureHandler.LOCKED_URL);
failureUrlMap.put(DisabledException.class.getName(), LoginAuthenticationFailureHandler.DISABLED_URL);
failureHandler.setExceptionMappings(failureUrlMap);
return failureHandler;
}
示例3: failureHandler
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
protected AuthenticationFailureHandler failureHandler() {
return new AuthenticationFailureHandler() {
@Override
public void onAuthenticationFailure(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException, ServletException {
httpServletResponse.getWriter().append("Authentication failure");
httpServletResponse.setStatus(401);
}
};
}
示例4: AjaxLoginProcessingFilter
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
public AjaxLoginProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例5: AdminUserProcessingFilter
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
public AdminUserProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例6: JwtTokenAuthenticationProcessingFilter
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
@Autowired
public JwtTokenAuthenticationProcessingFilter(AuthenticationFailureHandler failureHandler,
TokenExtractor tokenExtractor, RequestMatcher matcher) {
super(matcher);
this.failureHandler = failureHandler;
this.tokenExtractor = tokenExtractor;
}
示例7: RefreshTokenProcessingFilter
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
public RefreshTokenProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例8: JwtTokenAuthenticationProcessingFilter
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
@Autowired
public JwtTokenAuthenticationProcessingFilter(AuthenticationFailureHandler failureHandler,
TokenExtractor tokenExtractor, RequestMatcher matcher) {
super(matcher);
this.failureHandler = failureHandler;
this.tokenExtractor = tokenExtractor;
}
示例9: RestPublicLoginProcessingFilter
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
public RestPublicLoginProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例10: RestLoginProcessingFilter
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
public RestLoginProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例11: OneTimePasswordFilterConfigurer
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
public OneTimePasswordFilterConfigurer(final String loginProcessingUrl,
AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler,
AuthenticationEntryPoint entryPoint) {
this.authFilter = new OneTimePasswordAuthenticationFilter(loginProcessingUrl);
this.authFilter.setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher(loginProcessingUrl, "POST"));
this.authFilter.setAuthenticationSuccessHandler(successHandler);
this.authFilter.setAuthenticationFailureHandler(failureHandler);
this.authFilter.setAllowSessionCreation(true);
this.authenticationEntryPoint = entryPoint;
}
示例12: RefreshTokenProcessingFilter
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
public RefreshTokenProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例13: JwtTokenAuthenticationProcessingFilter
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
@Autowired
public JwtTokenAuthenticationProcessingFilter(AuthenticationFailureHandler failureHandler,
TokenExtractor tokenExtractor, RequestMatcher matcher) {
super(matcher);
this.failureHandler = failureHandler;
this.tokenExtractor = tokenExtractor;
}
示例14: RestPublicLoginProcessingFilter
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
public RestPublicLoginProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例15: RestLoginProcessingFilter
import org.springframework.security.web.authentication.AuthenticationFailureHandler; //导入依赖的package包/类
public RestLoginProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}