@Test public void testOnAuthenticationSuccess_SetIllegalUrlWhenUseDefaultRedirectToRedirectStrategy() throws Exception { RedirectAuthenticationHandler redireHandler = new RedirectAuthenticationHandler(); String redirectURI = "http: request.setParameter("redirectTo", redirectURI); String expectedRedirectURL = "http: redireHandler.onAuthenticationSuccess(request, response, auth); assertThat(response.getRedirectedUrl(), is(expectedRedirectURL)); }
@Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { String targetUrlParameter = getTargetUrlParameter(); if (targetUrlParameter != null && targetUrlParameterRedirectStrategy != null) { String redirectUrl = request.getParameter(targetUrlParameter); if (StringUtils.hasText(redirectUrl)) { clearAuthenticationAttributes(request); targetUrlParameterRedirectStrategy.sendRedirect(request, response, redirectUrl); return; } } super.onAuthenticationSuccess(request, response, authentication); }
RedirectAuthenticationHandler extends
                                           SavedRequestAwareAuthenticationSuccessHandler implements InitializingBean { @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { String targetUrlParameter = getTargetUrlParameter(); if (targetUrlParameter != null && targetUrlParameterRedirectStrategy != null) { String redirectUrl = request.getParameter(targetUrlParameter); if (StringUtils.hasText(redirectUrl)) { clearAuthenticationAttributes(request); targetUrlParameterRedirectStrategy.sendRedirect(request, response, redirectUrl); return; } } super.onAuthenticationSuccess(request, response, authentication); } }
RedirectAuthenticationHandler extends
                                           SavedRequestAwareAuthenticationSuccessHandler implements InitializingBean { @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { String targetUrlParameter = getTargetUrlParameter(); if (targetUrlParameter != null && targetUrlParameterRedirectStrategy != null) { String redirectUrl = request.getParameter(targetUrlParameter); if (StringUtils.hasText(redirectUrl)) { clearAuthenticationAttributes(request); targetUrlParameterRedirectStrategy.sendRedirect(request, response, redirectUrl); return; } } super.onAuthenticationSuccess(request, response, authentication); } RedirectAuthenticationHandler(); }
RedirectAuthenticationHandler extends
                                           SavedRequestAwareAuthenticationSuccessHandler implements InitializingBean { @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { String targetUrlParameter = getTargetUrlParameter(); if (targetUrlParameter != null && targetUrlParameterRedirectStrategy != null) { String redirectUrl = request.getParameter(targetUrlParameter); if (StringUtils.hasText(redirectUrl)) { clearAuthenticationAttributes(request); targetUrlParameterRedirectStrategy.sendRedirect(request, response, redirectUrl); return; } } super.onAuthenticationSuccess(request, response, authentication); } RedirectAuthenticationHandler(); void setRedirectToRedirectStrategy(
            RedirectStrategy redirectToRedirectStrategy); @Override void onAuthenticationSuccess(HttpServletRequest request,
            HttpServletResponse response,
            Authentication authentication); @Override void afterPropertiesSet(); }
RedirectAuthenticationHandler extends
                                           SavedRequestAwareAuthenticationSuccessHandler implements InitializingBean { @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { String targetUrlParameter = getTargetUrlParameter(); if (targetUrlParameter != null && targetUrlParameterRedirectStrategy != null) { String redirectUrl = request.getParameter(targetUrlParameter); if (StringUtils.hasText(redirectUrl)) { clearAuthenticationAttributes(request); targetUrlParameterRedirectStrategy.sendRedirect(request, response, redirectUrl); return; } } super.onAuthenticationSuccess(request, response, authentication); } RedirectAuthenticationHandler(); void setRedirectToRedirectStrategy(
            RedirectStrategy redirectToRedirectStrategy); @Override void onAuthenticationSuccess(HttpServletRequest request,
            HttpServletResponse response,
            Authentication authentication); @Override void afterPropertiesSet();  }