From e61bc7e93bfd074aca468b6bcee3fd35b2adf0f5 Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Wed, 9 Mar 2016 10:12:45 -0600 Subject: [PATCH] Polish ForwardAuthenticationFailureHandler * Whitespace cleanup * Add @since Issue gh-3727 --- .../ForwardAuthenticationFailureHandler.java | 7 +++---- .../ForwardAuthenticationFailureHandlerTests.java | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/web/src/main/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandler.java b/web/src/main/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandler.java index ac0651e336..aa75828db6 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandler.java +++ b/web/src/main/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandler.java @@ -31,7 +31,7 @@ import java.io.IOException; *

* * @author Shazin Sadakath - * + * @since 4.1 */ public class ForwardAuthenticationFailureHandler implements AuthenticationFailureHandler { @@ -41,12 +41,11 @@ public class ForwardAuthenticationFailureHandler implements AuthenticationFailur * @param forwardUrl */ public ForwardAuthenticationFailureHandler(String forwardUrl) { - Assert.isTrue(UrlUtils.isValidRedirectUrl(forwardUrl), "'" - + forwardUrl + "' is not a valid forward URL"); + Assert.isTrue(UrlUtils.isValidRedirectUrl(forwardUrl), "'" + + forwardUrl + "' is not a valid forward URL"); this.forwardUrl = forwardUrl; } - @Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { request.setAttribute(WebAttributes.AUTHENTICATION_EXCEPTION, exception); request.getRequestDispatcher(forwardUrl).forward(request, response); diff --git a/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandlerTests.java index 1ff3c131f1..1b19ec0b50 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandlerTests.java @@ -30,7 +30,7 @@ import static org.mockito.Mockito.mock; *

* * @author Shazin Sadakath - * + * @since4.1 */ public class ForwardAuthenticationFailureHandlerTests { @@ -55,6 +55,6 @@ public class ForwardAuthenticationFailureHandlerTests { fafh.onAuthenticationFailure(request, response, e); assertThat(response.getForwardedUrl()).isEqualTo("/forwardUrl"); - assertThat(request.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION)).isEqualTo(e); + assertThat(request.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION)).isEqualTo(e); } }