diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenAuthenticationProvider.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenAuthenticationProvider.java index fec9821e9f..d8ece9e740 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenAuthenticationProvider.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenAuthenticationProvider.java @@ -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); } } diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManager.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManager.java index d3c62c0dd9..79c271e923 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManager.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManager.java @@ -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