oauth2Login() AuthenticationProvider's preserve root cause exception when rethrown
Closes gh-10228
This commit is contained in:
parent
5830fda2fa
commit
97c949d929
|
@ -110,7 +110,7 @@ public class OAuth2LoginAuthenticationProvider implements AuthenticationProvider
|
|||
}
|
||||
catch (OAuth2AuthorizationException ex) {
|
||||
OAuth2Error oauth2Error = ex.getError();
|
||||
throw new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString());
|
||||
throw new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString(), ex);
|
||||
}
|
||||
OAuth2AccessToken accessToken = authorizationCodeAuthenticationToken.getAccessToken();
|
||||
Map<String, Object> additionalParameters = authorizationCodeAuthenticationToken.getAdditionalParameters();
|
||||
|
|
|
@ -99,7 +99,7 @@ public class OAuth2LoginReactiveAuthenticationManager implements ReactiveAuthent
|
|||
}
|
||||
return this.authorizationCodeManager.authenticate(token)
|
||||
.onErrorMap(OAuth2AuthorizationException.class,
|
||||
(e) -> new OAuth2AuthenticationException(e.getError(), e.getError().toString()))
|
||||
(e) -> new OAuth2AuthenticationException(e.getError(), e.getError().toString(), e))
|
||||
.cast(OAuth2AuthorizationCodeAuthenticationToken.class).flatMap(this::onSuccess);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ public class OidcAuthorizationCodeAuthenticationProvider implements Authenticati
|
|||
}
|
||||
catch (OAuth2AuthorizationException ex) {
|
||||
OAuth2Error oauth2Error = ex.getError();
|
||||
throw new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString());
|
||||
throw new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ public class OidcAuthorizationCodeReactiveAuthenticationManager implements React
|
|||
return this.accessTokenResponseClient.getTokenResponse(authzRequest).flatMap(
|
||||
(accessTokenResponse) -> authenticationResult(authorizationCodeAuthentication, accessTokenResponse))
|
||||
.onErrorMap(OAuth2AuthorizationException.class,
|
||||
(e) -> new OAuth2AuthenticationException(e.getError(), e.getError().toString()))
|
||||
(e) -> new OAuth2AuthenticationException(e.getError(), e.getError().toString(), e))
|
||||
.onErrorMap(JwtException.class, (e) -> {
|
||||
OAuth2Error invalidIdTokenError = new OAuth2Error(INVALID_ID_TOKEN_ERROR_CODE, e.getMessage(),
|
||||
null);
|
||||
|
|
Loading…
Reference in New Issue