Skip to content

Commit

Permalink
Add authRequest field to AuthenticationException
Browse files Browse the repository at this point in the history
Store the authentication request details in the `authRequest` field of
`AuthenticationException` when an authentication exception occurs.

Closes spring-projectsgh-16444

Signed-off-by: amm0124 <[email protected]>
  • Loading branch information
amm0124 authored and jzheaux committed Feb 3, 2025
1 parent e63ef3c commit 872f77e
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public abstract class AuthenticationException extends RuntimeException {
@Serial
private static final long serialVersionUID = 2018827803361503060L;

private final Authentication authRequest;

/**
* Constructs an {@code AuthenticationException} with the specified message and root
* cause.
Expand All @@ -37,6 +39,7 @@ public abstract class AuthenticationException extends RuntimeException {
*/
public AuthenticationException(String msg, Throwable cause) {
super(msg, cause);
this.authRequest = null;
}

/**
Expand All @@ -46,6 +49,12 @@ public AuthenticationException(String msg, Throwable cause) {
*/
public AuthenticationException(String msg) {
super(msg);
this.authRequest = null;
}

public AuthenticationException(String msg, Authentication authRequest) {
super(msg);
this.authRequest = authRequest;
}

}

0 comments on commit 872f77e

Please sign in to comment.