|
29 | 29 | import jakarta.servlet.ServletResponse; |
30 | 30 | import jakarta.servlet.http.HttpServletRequest; |
31 | 31 | import jakarta.servlet.http.HttpServletResponse; |
32 | | -import jakarta.servlet.http.HttpSession; |
33 | 32 |
|
34 | | -import org.springframework.security.core.AuthenticationException; |
35 | | -import org.springframework.security.web.WebAttributes; |
36 | 33 | import org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter; |
37 | 34 | import org.springframework.util.Assert; |
38 | | -import org.springframework.util.StringUtils; |
39 | 35 |
|
40 | 36 | // CPD-OFF - Upstream copy |
41 | 37 |
|
@@ -369,8 +365,11 @@ protected String renderHeaders(final HttpServletRequest request) |
369 | 365 | } |
370 | 366 |
|
371 | 367 | protected String renderFormLogin( |
372 | | - final HttpServletRequest request, final boolean loginError, final boolean logoutSuccess, |
373 | | - final String contextPath, final String errorMsg) |
| 368 | + final HttpServletRequest request, |
| 369 | + final boolean loginError, |
| 370 | + final boolean logoutSuccess, |
| 371 | + final String contextPath, |
| 372 | + final String errorMsg) |
374 | 373 | { |
375 | 374 | if(!this.formLoginEnabled) |
376 | 375 | { |
@@ -485,21 +484,9 @@ protected static String renderSaml2Row(final String contextPath, final String ur |
485 | 484 |
|
486 | 485 | protected String getLoginErrorMessage(final HttpServletRequest request) |
487 | 486 | { |
488 | | - final HttpSession session = request.getSession(false); |
489 | | - if(session == null) |
490 | | - { |
491 | | - return "Invalid credentials"; |
492 | | - } |
493 | | - if(!(session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION) |
494 | | - instanceof final AuthenticationException exception)) |
495 | | - { |
496 | | - return "Invalid credentials"; |
497 | | - } |
498 | | - if(!StringUtils.hasText(exception.getMessage())) |
499 | | - { |
500 | | - return "Invalid credentials"; |
501 | | - } |
502 | | - return exception.getMessage(); |
| 487 | + // Was changed in Spring Boot 3.5 to always return the same message |
| 488 | + // https://github.com/spring-projects/spring-security/commit/c4b223266c7c4713823634326705b586b47a58c4 |
| 489 | + return "Invalid credentials"; |
503 | 490 | } |
504 | 491 |
|
505 | 492 | protected String renderHiddenInput(final String name, final String value) |
|
0 commit comments