Skip to content

Commit 7ccc915

Browse files
ascopesjzheaux
authored andcommitted
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.
1 parent e9d5bbb commit 7ccc915

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenAuthenticationProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public final class OpaqueTokenAuthenticationProvider implements AuthenticationPr
6666

6767
private final Log logger = LogFactory.getLog(getClass());
6868

69-
private OpaqueTokenIntrospector introspector;
69+
private final OpaqueTokenIntrospector introspector;
7070

7171
/**
7272
* Creates a {@code OpaqueTokenAuthenticationProvider} with the provided parameters
@@ -104,10 +104,10 @@ private OAuth2AuthenticatedPrincipal getOAuth2AuthenticatedPrincipal(BearerToken
104104
}
105105
catch (BadOpaqueTokenException failed) {
106106
this.logger.debug("Failed to authenticate since token was invalid");
107-
throw new InvalidBearerTokenException(failed.getMessage());
107+
throw new InvalidBearerTokenException(failed.getMessage(), failed);
108108
}
109109
catch (OAuth2IntrospectionException failed) {
110-
throw new AuthenticationServiceException(failed.getMessage());
110+
throw new AuthenticationServiceException(failed.getMessage(), failed);
111111
}
112112
}
113113

oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
*/
6262
public class OpaqueTokenReactiveAuthenticationManager implements ReactiveAuthenticationManager {
6363

64-
private ReactiveOpaqueTokenIntrospector introspector;
64+
private final ReactiveOpaqueTokenIntrospector introspector;
6565

6666
/**
6767
* Creates a {@code OpaqueTokenReactiveAuthenticationManager} with the provided

0 commit comments

Comments
 (0)