List of usage examples for org.springframework.security.web DefaultRedirectStrategy sendRedirect
public void sendRedirect(HttpServletRequest request, HttpServletResponse response, String url) throws IOException
From source file:org.apache.rave.portal.web.controller.handler.OpenIDAuthenticationFailureHandler.java
@Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { if (exception instanceof UsernameNotFoundException && exception.getAuthentication() instanceof OpenIDAuthenticationToken && ((OpenIDAuthenticationToken) exception.getAuthentication()).getStatus() .equals(OpenIDAuthenticationStatus.SUCCESS)) { OpenIDAuthenticationToken token = (OpenIDAuthenticationToken) exception.getAuthentication(); String url = token.getIdentityUrl(); User user = createTemporaryUser(token, url); request.getSession(true).setAttribute(ModelKeys.NEW_USER, user); DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy(); log.info("Redirecting to new user account creation page"); super.setRedirectStrategy(redirectStrategy); redirectStrategy.sendRedirect(request, response, "/" + ViewNames.CREATE_ACCOUNT_PAGE); return;//from w w w . j a v a2 s . c o m } else { super.onAuthenticationFailure(request, response, exception); } }