-
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
Support JWT for Client Authentication #8175
Comments
Cool. Authenticating with Azure AD using a certificate uses this flow, afaics. This feature will help us executing that flow cleanly. Thx. |
I believe that this would also provide better support for "Sign In With Apple", as Apple uses a non-static client secret, which in their case must be the string representation of a JWT (seemingly compliant with the JWT profile covered in the issue) with an expiration date of at most 6 months in the future (see https://developer.apple.com/documentation/sign_in_with_apple/generate_and_validate_tokens). |
@thomas-corte Thanks for pointing that out. Indeed, Apple does support FYI, we are targeting this for 5.5 but we're dependent on merging #9208 first, which we are getting close. |
Not sure whether this helps (as #9208 seems to aim at using the Nimbus libraries), but for comparison, I was able to successfully create a working secret for Apple using this code (which utilizes BouncyCastle and the io.jsonwebtoken library): import java.util.Date; import java.io.Reader; import java.security.Key; import io.jsonwebtoken.JwtBuilder; import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; import org.bouncycastle.openssl.PEMParser; import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter; ...
|
Thanks for the sample @thomas-corte. We will be using Nimbus for implementation. |
Any updates on this? |
@willladislaw I'm starting work on this next week. |
@roelal @thomas-corte @willladislaw Please see #9520. It would be greatly appreciated if you can test out the initial implementation with the provider(s) you are using. FYI, I need to get this merged before April 12 for |
I tried to download the sources from your branch and build it with Gradle, but I'm not having sufficient access to the required dependencies (Received status code 401 from server: Unauthorized), probably related to this issue: https://stackoverflow.com/questions/64839144/got-an-error-when-building-spring-security-from-source |
I would like to help out with testing support for 'Private Key JWT Client Authentication'. The Australian Government's Trusted Digital Identity Framework requires Relying Party's to use Private Key JWT Client Authentication. Ref: |
Maven repository unavailable. How do I add this dependency? (Spring Boot) |
@willladislaw Spring Security 5.5.0-RC1 is only available in See the Spring Boot reference on how to setup the Spring Maven repo. |
How long before |
I'm eager to try this out, but I didn't get any further after I added the following to my config class (and removed clientSecret): Should I customize any Spring Security class and sign the JWT by using Nimbus? In that case, in which class? Or is it possible to add the certificate along with the private key to an existing Spring Security class? |
I tried out this, but did not get it to work, seems like x5t:base64EncodedThumprintHere and typ:jwt parameters inside the client_assertion are not sent to to the Authentication provider at all. |
@thomas-corte do you have a working example of how to configure the application.yaml and how to use a non-static client secret using the private key? |
No, just what I wrote here: |
@thomas-corte so are you manually "fixing" the |
No, this is not production code, I just wanted to provide a working example for generating a suitable secret to the maintainers of the related Spring code. |
if anybody has a working Spring Boot example that dynamically generates a (non-static) "client secret" for providers such as Apple, then please reference it here |
Private Key JWT Client Authentication using nimbus-jose-jwt. gist: https://gist.github.com/Robinyo/cc90c191be74ca173fb483199b3efceb |
@Robinyo i'm looking for a solution that's compatible with this configuration: application.yaml
|
Spring Boot and Keycloak example: application.yml |
@alan-czajkowski were you able to find an working example with dynamic client secret ? |
@sabareeshkkanan no, I was not able to find a working example using a dynamic client secret ... so I created my own: let me know if that works for you |
So, is Apple Authentication supported? Is there any documentation/examples? Where should I put the private key, teamId etc? |
@alexsyd this is an outdated example (I need to update it), but it gives you an idea of how you need to do Apple Sign-in, unfortunately Apple makes it incredibly difficult relative to everybody else (Google, Facebook, etc.) the main thing you need to do is create the client secret (the JWT) before the Spring Boot application starts, so that you can do some magic injection into the application.yaml, and then start the application, I've documented it pretty well: |
it would be helpful if Spring Boot could just implement this (painful) use-case by Apple, and do the client secret (JWT) generation, if the sign-in partner (like Apple) requires it |
This feature will partially implement JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants.
Section 2.2. Using JWTs for Client Authentication will be the focus for this feature implementation.
NOTE: This ticket addresses client-side support only.
Related #6881 #6053
The text was updated successfully, but these errors were encountered: