Ensuring consistency in error handling of opaque providers/managers

The OpaqueTokenAuthenticationProvider now propagates the cause of
introspection exceptions in the same way that the reactive
OpaqueTokenReactiveAuthenticationManager does.

Fixed a final field warning on both OpaqueTokenAuthenticationProvider
and OpaqueTokenReactiveAuthenticationManager.
This commit is contained in:
Ashley Scopes 2021-08-15 15:25:52 +01:00 committed by Josh Cummings
parent e9d5bbba34
commit 7ccc915b2b
2 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ public final class OpaqueTokenAuthenticationProvider implements AuthenticationPr
private final Log logger = LogFactory.getLog(getClass());
private OpaqueTokenIntrospector introspector;
private final OpaqueTokenIntrospector introspector;
/**
* Creates a {@code OpaqueTokenAuthenticationProvider} with the provided parameters
@ -104,10 +104,10 @@ public final class OpaqueTokenAuthenticationProvider implements AuthenticationPr
}
catch (BadOpaqueTokenException failed) {
this.logger.debug("Failed to authenticate since token was invalid");
throw new InvalidBearerTokenException(failed.getMessage());
throw new InvalidBearerTokenException(failed.getMessage(), failed);
}
catch (OAuth2IntrospectionException failed) {
throw new AuthenticationServiceException(failed.getMessage());
throw new AuthenticationServiceException(failed.getMessage(), failed);
}
}

View File

@ -61,7 +61,7 @@ import org.springframework.util.Assert;
*/
public class OpaqueTokenReactiveAuthenticationManager implements ReactiveAuthenticationManager {
private ReactiveOpaqueTokenIntrospector introspector;
private final ReactiveOpaqueTokenIntrospector introspector;
/**
* Creates a {@code OpaqueTokenReactiveAuthenticationManager} with the provided