@@ -31,15 +31,7 @@ public abstract class AuthenticationException extends RuntimeException {
31
31
@ Serial
32
32
private static final long serialVersionUID = 2018827803361503060L ;
33
33
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 ;
43
35
44
36
/**
45
37
* Constructs an {@code AuthenticationException} with the specified message and root
@@ -49,7 +41,6 @@ public abstract class AuthenticationException extends RuntimeException {
49
41
*/
50
42
public AuthenticationException (String msg , Throwable cause ) {
51
43
super (msg , cause );
52
- this .authRequest = null ;
53
44
}
54
45
55
46
/**
@@ -59,23 +50,33 @@ public AuthenticationException(String msg, Throwable cause) {
59
50
*/
60
51
public AuthenticationException (String msg ) {
61
52
super (msg );
62
- this .authRequest = null ;
63
53
}
64
54
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
+ }
65
67
66
68
/**
67
- * Sets the {@link Authentication} object representing the failed authentication
69
+ * Set the {@link Authentication} object representing the failed authentication
68
70
* attempt.
69
71
* <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
75
76
*/
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 ;
79
80
}
80
81
81
82
}
0 commit comments