You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6458f2f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: spring-security-mvc-custom/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java
* Invokes the configured {@code RedirectStrategy} with the URL returned by the {@code determineTargetUrl} method.
32
-
* <p>
33
-
* The redirect will not be performed if the response has already been committed.
34
-
*/
35
-
protected void handle(final HttpServletRequest request, final HttpServletResponse response, final Authentication authentication) throws IOException, ServletException {
36
-
final String targetUrl = determineTargetUrl(request, response);
28
+
// API
29
+
30
+
@Override
31
+
public void onAuthenticationSuccess(final HttpServletRequest request, final HttpServletResponse response, final Authentication authentication) throws IOException {
32
+
handle(request, response, authentication);
33
+
clearAuthenticationAttributes(request);
34
+
}
35
+
36
+
// IMPL
37
+
38
+
protected void handle(final HttpServletRequest request, final HttpServletResponse response, final Authentication authentication) throws IOException {
39
+
final String targetUrl = determineTargetUrl(authentication);
37
40
38
41
if (response.isCommitted()) {
39
42
logger.debug("Response has already been committed. Unable to redirect to " + targetUrl);
* Calls the parent class {@code handle()} method to forward or redirect to the target URL, and
86
-
* then calls {@code clearAuthenticationAttributes()} to remove any leftover session data.
87
-
*/
88
-
@Override
89
-
public void onAuthenticationSuccess(final HttpServletRequest request, final HttpServletResponse response, final Authentication authentication) throws IOException, ServletException {
90
-
handle(request, response, authentication);
91
-
clearAuthenticationAttributes(request);
92
-
}
93
-
94
72
/**
95
73
* Removes temporary authentication-related data which may have been stored in the session
96
74
* during the authentication process.
@@ -105,4 +83,12 @@ protected final void clearAuthenticationAttributes(final HttpServletRequest requ
0 commit comments