-
Notifications
You must be signed in to change notification settings - Fork 57
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
Introduce JWT Builder API #149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did only a brief review of the PR, I did not check the API in detail (but I assume this is already in SmallRye and thus more or less proven to be useable)
Important question is why we define an API to generate any kind of JWT (JWS and JWE with many options) when there are already at least 3 libraries which does the same.
One remark from the past was that developers should not generate their own JWT tokens, this is something the authentication provider (like Keycloak) does. And if you really need such an API, I see only room for a very minimal API which generates JWTs indicated in the spec.
Also missing an extensive set of TCKs to test the implementations of this API.
api/src/main/java/org/eclipse/microprofile/jwt/algorithm/SignatureAlgorithm.java
Outdated
Show resolved
Hide resolved
api/src/main/java/org/eclipse/microprofile/jwt/algorithm/KeyEncryptionAlgorithm.java
Outdated
Show resolved
Hide resolved
api/src/main/java/org/eclipse/microprofile/jwt/algorithm/KeyEncryptionAlgorithm.java
Outdated
Show resolved
Hide resolved
api/src/main/java/org/eclipse/microprofile/jwt/algorithm/SignatureAlgorithm.java
Outdated
Show resolved
Hide resolved
api/src/main/java/org/eclipse/microprofile/jwt/builder/JwtEncryption.java
Outdated
Show resolved
Hide resolved
api/src/main/java/org/eclipse/microprofile/jwt/builder/JwtEncryption.java
Show resolved
Hide resolved
api/src/main/java/org/eclipse/microprofile/jwt/builder/JwtSignatureBuilder.java
Outdated
Show resolved
Hide resolved
api/src/main/java/org/eclipse/microprofile/jwt/builder/JwtSignatureBuilder.java
Outdated
Show resolved
Hide resolved
/** | ||
* Name of the default {@code JwtProvider} implementation class. | ||
*/ | ||
private static final String DEFAULT_JWT_PROVIDER = "io.smallrye.jwt.build.impl.JwtProviderImpl"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smallrye
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will follow the resolution as per the above comment
@rdebusscher Hi, thanks for the review so far, I'll deal with you individual comments later, here is feedback on your first general one
We have Quarkus users trying it yes.
There is some mix up here. It does not matter how many libraries are around, the goal is to enrich MP JWT with its own Note there is also a task to support MP JWT accepting the JWE-protected tokens. Hence the JWE option.
I myself have been issuing such remarks but MP JWT has not been designed as an OIDC adapter, i.e the library that must be accepting the tokens as part of OIDC flows only and the reality is right now the developers use it for all sort of JWT token issuance scenarios, including self-issuing, with every developer code using, well, some specific library, which is what this API is about to address.
I disagree with it. It has not played well for MP JWT to require that Likewise MP JWT Generation API should see further than just issuing MP-JWT tokens with the limited support which are only meant for MP JWT servers, this is a close world assumption.
Lets move step by step, need to finalize this API first |
@rdebusscher Replied to all the comments. Thanks for the comprehensive feedback, lets keep going :-) |
I know there is an open task for JWE, so that should be decided and implemented in the spec firest before we should be think of creating a JWE. An open spec doesn't work. Because if there is tomorrow a new signing algorithm, it is assumed to be supported automatically by this API which is not the cause of course. |
api/src/main/java/org/eclipse/microprofile/jwt/algorithm/ContentEncryptionAlgorithm.java
Outdated
Show resolved
Hide resolved
api/src/main/java/org/eclipse/microprofile/jwt/algorithm/KeyEncryptionAlgorithm.java
Outdated
Show resolved
Hide resolved
I don't think that it should be decided and implemented first.
You haven't looked carefully enough. The algorithms are typed and only those which are well known in the JWA spec are typed. Furthermore, only a bare minimum is required to be supported. The rest - is optional. The users won't be able to bypass it, see the
Exactly, this will be done for the minimum required set |
cc88fee
to
64031cc
Compare
@rdebusscher I've trimmed down the list of algorithms significantly; let me resolve some of the converstaions (feel free please to reopen as needed) and I will follow with some comments on the update. Thanks |
Hi @rdebusscher,
Thanks |
Thanks @sberyozkin, The restricted algo list and encryption makes sense and we don't try to support all the algos and methods which exist. |
932a0fc
to
fcc2ca1
Compare
@rdebusscher Hi, may be of interest, right now I'll use smallrye-jwt to build a JWT to support a client_secret_jwt OIDC client authentication using |
fcc2ca1
to
6d0f4c6
Compare
6d0f4c6
to
3e18850
Compare
To-do list for myself:
|
Marking for 2.0 for now. I'll see if I can find the time to complete it earlier, but it is pretty tight so 2.0 may be more appropriate, we'll see |
Catching up on this thread. I agree with @rdebusscher earlier comments that JWT creation has explicitly been identified in the past as out of scope. Here were some of the reasons:
If one were created we'd want it to in some way be optional so that we'd be free to not go that direction. |
@dblevins David, thanks, but you may have misunderstood the goal of the PR. Instead of every developer having to hack some non-portable and non-controlled code this PR will give them a chance to write a code which works across multiple libraries, and this code will be TCK verified. This API has been carefully designed such that it does not require an academic qualification to implement. I have a 1st hand experience in implementing JOSE so I know what I'm proposing, please don't take it as some over-confident remark. And please, don't say it is hard to implement :-), certainly not for the Tomitribe team :-). I can share a link to the branch where I coded it on top of Jose4j in half a day. I'd like you to trust this API has not been baked in a rush - we have Quarkus users experimenting with it in our project and everyone I've talked to about it is happy, The other important point which has been discussed earlier is that it is pretty important to open MP JWT both ways for it to appeal to a larger audience - for it not only be a server but become a producer and also show some lead in supporting not only signed but signed and/or encrypted tokens. CC @rdebusscher |
@dblevins I'll have no problems making it optional for the implementers to support, so if TomiTribe would prefer recommending its uses to code directly against Jose4J or other lower level library then I'll be fine with making the spec allowing for it :-) |
@dblevins, I've updated my to do list to consider making it optional, I'll discuss it with other implementers in a couple of months when we'll be getting closer to 2.0, but as I said I won't mind myself. And... good to talk to you again :-) |
@dblevins Sorry, I've spent half a day at implementing the minimum JWE server support, got confused, but this API is pretty straghtforward to implement, certainly not longer than few days or not much longer. It took me awhile to implement it because I was experimenting, but I honestly don't expect anyone spend much time on implementing this API |
@rdebusscher Hi Rudy, I think I'll make a summary of our disccussion with you and David and the pending review comments in the linked issue and will open a new fresh PR otherwise it will be difficult to continue a good discussion with so many comments already available. I'll do it for MP JWT 2.0. |
No description provided.