@@ -31,15 +31,7 @@ public abstract class AuthenticationException extends RuntimeException {
3131 @ Serial
3232 private static final long serialVersionUID = 2018827803361503060L ;
3333
34- /**
35- * The {@link Authentication} object representing the failed authentication attempt.
36- * <p>
37- * This field captures the authentication request that was attempted but ultimately
38- * failed, providing critical information for diagnosing the failure and facilitating
39- * debugging. If set, the value must not be null.
40- * </p>
41- */
42- private Authentication authRequest ;
34+ private Authentication authenticationRequest ;
4335
4436 /**
4537 * Constructs an {@code AuthenticationException} with the specified message and root
@@ -49,7 +41,6 @@ public abstract class AuthenticationException extends RuntimeException {
4941 */
5042 public AuthenticationException (String msg , Throwable cause ) {
5143 super (msg , cause );
52- this .authRequest = null ;
5344 }
5445
5546 /**
@@ -59,23 +50,33 @@ public AuthenticationException(String msg, Throwable cause) {
5950 */
6051 public AuthenticationException (String msg ) {
6152 super (msg );
62- this .authRequest = null ;
6353 }
6454
55+ /**
56+ * Get the {@link Authentication} object representing the failed authentication
57+ * attempt.
58+ * <p>
59+ * This field captures the authentication request that was attempted but ultimately
60+ * failed, providing critical information for diagnosing the failure and facilitating
61+ * debugging
62+ * @since 6.5
63+ */
64+ public Authentication getAuthenticationRequest () {
65+ return this .authenticationRequest ;
66+ }
6567
6668 /**
67- * Sets the {@link Authentication} object representing the failed authentication
69+ * Set the {@link Authentication} object representing the failed authentication
6870 * attempt.
6971 * <p>
70- * This method allows the injection of the authentication request that resulted in a
71- * failure. The provided {@code authRequest} should not be null if set.
72- * </p>
73- * @param authRequest the authentication request associated with the failed
74- * authentication attempt.
72+ * The provided {@code authenticationRequest} should not be null
73+ * @param authenticationRequest the authentication request associated with the failed
74+ * authentication attempt
75+ * @since 6.5
7576 */
76- public void setAuthRequest (Authentication authRequest ) {
77- Assert .notNull (authRequest , "AuthRequest cannot be null" );
78- this .authRequest = authRequest ;
77+ public void setAuthenticationRequest (Authentication authenticationRequest ) {
78+ Assert .notNull (authenticationRequest , "authenticationRequest cannot be null" );
79+ this .authenticationRequest = authenticationRequest ;
7980 }
8081
8182}
0 commit comments