-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAuth2ResourceServerConfigurer#authenticationManagerResolver should override #jwt #16406
Comments
Thanks, @jgrandja, I'll take a look. It's quite common in Spring Security for the last-configured component to take precedence, so I imagine this is a reasonable improvement. The only thing I hesitate on is that disallowing this seems to have been intentional in the code. Either way, I've marked this as |
One possible solution might be to just remove the code block starting on line 356 As I see this, there are 3 possible configurations
and just one of them can be applied. This will be a breaking change, therefore some code for fail-fast if oauth is not configured properly, will be required. |
That block of code was added in spring-authorization-server#707 to simplify configuring Authorization Server. So I don't think we want to remove that block and force the user to explicitly configure |
I agree. As of now, if a default is set ( |
It seems like putting
before
fixes the issue, but this should be verified by @malvinpatrick as well. I need some more Spring Security debugging-time to explain why and to discover any gotchas with this solution, unless one of you guys know the answers.
works as expected. |
Woahh thankyou @roar-skinderviken, in my case it solved the problem, but when you add I've tried your solution on this config, but I'm not pretty sure my code is a good way. Based on this documentation, default So I create CustomOpaqueTokenIntrospector Can you guys review my code ? If it good, maybe this can be a default OpaqueTokenIntrospector for Spring Authorization Server Project. |
@malvinpatrick |
Given the following configuration:
The application context will fail to build with the error message:
The reason is because
OAuth2AuthorizationServerConfigurer
will default toresourceServer.jwt()
if the OIDC UserInfo endpoint or OIDC Client Registration endpoint is enabled. However, if an application configures a client to use opaque tokens for an OpenID Connect flow, then configuring theauthenticationManagerResolver()
should be possible if support for both JWT and Opaque access tokens is required. As of now, it's not possible sinceresourceServer.jwt()
was previously configured as the default byOAuth2AuthorizationServerConfigurer
.A similar error condition occurs with the following configuration:
The error message is:
The application is not able to override the default
resourceServer.jwt()
configured byOAuth2AuthorizationServerConfigurer
to configure support forresourceServer.opaqueToken()
instead.The text was updated successfully, but these errors were encountered: