-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Provide support for symmetric key verification via JwtDecoder #5465
Comments
Thanks for the report @sirianni! I think being able to customize the implementation is important, but I think the first step is to fix the default implementation so it works with Ping. |
OK. What approach would you suggest for that? I may be able to work on a PR. |
If you don't view the Ping approach of reusing the client secret as a symmetric JWT signing key as a special case, a configuration-only approach might suffice. You could be to add another field to
|
Looks like Auth0 allows a symmetric key to be used also: However, they don't reuse the client_secret. It's a separately configured value (if I'm reading the docs correctly).
|
@sirianni Can you please provide more details around the issue you are having.
Specifically, what is the I agree with @rwinch, let's ensure we have things working out-of-the-box for Ping before we expose configuration points that allow for customization. |
As an aside, I will say that it seems the Spring OAuth2 coding style has deviated from the standard Spring practice of coding for extensibility that has made Spring so popular. The code uses some fairly paranoid practices like marking classes as
Right, I get it. I hope you can see from the comments above that I'm trying to help you assess the ability to have a generic "out of the box" solution that works for Ping.
As I mentioned in my comment above (with screenshot of Ping docs), Ping is signing with Right off the bat you can see that public NimbusJwtDecoderJwkSupport(String jwkSetUrl) {
this(jwkSetUrl, JwsAlgorithms.RS256);
} Stacktrace:
|
Note that Nimbus' native /**
* Validator of ID tokens issued by an OpenID Provider (OP).
*
* <p>Supports processing of ID tokens with the following protection:
*
* <ul>
* <li>ID tokens signed (JWS) with the OP's RSA or EC key, require the
* OP public JWK set (provided by value or URL) to verify them.
* <li>ID tokens authenticated with a JWS HMAC, require the client's secret
* to verify them.
* <li>Unsecured (plain) ID tokens received at the token endpoint.
* </ul>
*
* <p>Convenience static methods for creating an ID token validator from OpenID
* Provider metadata or issuer URL, and the registered Relying Party
* information:
*
* <ul>
* <li>{@link #create(OIDCProviderMetadata, OIDCClientInformation)}
* <li>{@link #create(Issuer, OIDCClientInformation)}
* </ul>
*
* <p>Related specifications:
*
* <ul>
* <li>OpenID Connect Core 1.0, sections 3.1.3.7, 3.2.2.11 and 3.3.2.12.
* </ul>
*/
@ThreadSafe
public class IDTokenValidator extends AbstractJWTValidator implements ClockSkewAware { |
@sirianni Thank you for all your feedback!
This is very true and quite intentional in the short term. We are adding lots of new functionality at a fast pace and so we are starting out quite cautious. As we get reasonable enhancement requests, we will be able to spend time to improve the flexibility that users are use to. If you find places you need to customize that are not easy to do so, please let us know and we will work with you to update the code. I want to emphasize that we agree that customization of the signature verification is desirable. However, we want to prioritize fixing this to work out of the box first. It may seem very easy to expose a new API, but as a framework every API we create and expose limits our ability to refactor the code later. I hope this helps alleviate any concerns you might have. Thanks again for working with us to make Spring Security better! |
This was intentional to support Symmetric key verification on the other hand is going to be more involved.
Yes it does but this is a lot more involved. The There is a lot more work that needs to be done to have full support for OAuth/OIDC and related extension specs. We will get there but it will take some more time. We'll prioritize symmetric key verification support so please stay tuned. Thanks again for the feedback. |
@sirianni We were really hoping to resolve this issue and get it into 5.1, but unfortunately we didn't have enough resources to get to this. However, we're still hoping to resolve #5717 for 5.1 and I believe this will still help you as it will allow you to configure a custom Would you be interested in submitting a PR for #5717 ? |
@jgrandja Except in Test, how does one setJwsAlgorithmResolver? I can't seem to get the value to be anything but RS256. |
you just have to create your own JwtDecoderFactory-Bean like:
|
Did this change include dynamically choosing the Algorithm? At ".well-known/openid-configuration" our auth server responds with multiple values: "id_token_signing_alg_values_supported":["none","HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512"]. Of course the token header has a specific value but I'm not sure if a client would know this value ahead of time. |
@pthorson No it doesn't include this change as we cannot randomly choose the algorithm given that NOTE: |
I need multiple algorithm for NimbusJwtDecoderJwkSupport constructor as well, rather than hard coded RS256, I found it's hard to override the alg, even though I create my own JwtDecoder, because it is initized in OidcAuthorizationCodeAuthenticationProvider (line 212), and this cannot be changed if we don't want to change more code, please let me know the work around for current release, thank you very much! |
@compfantasy See comment |
JWT signature verification for
id_token
fails inOidcAuthorizationCodeAuthenticationProvider
for OIDC providers like Ping Federate that have alternate signature verification rules.From Ping Identity Developers Guide:
And
These rules are valid according to the OpenID Connect specification:
There is a method within
OidcAuthorizationCodeAuthenticationProvider
to dynamically lookup aJwtDecoder
for a givenClientRegistration
:A few challenges here:
private
.oauth2Login()
configuration DSLAs such, there need to be changes to the core classes to enable such pluggability.
The text was updated successfully, but these errors were encountered: