-
Notifications
You must be signed in to change notification settings - Fork 49
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
Initial JWT builder code and tests #153
Conversation
pom.xml
Outdated
@@ -35,7 +35,7 @@ | |||
<properties> | |||
<version.eclipse.microprofile.jwt>1.1.1</version.eclipse.microprofile.jwt> | |||
<version.microprofile.config>1.3</version.microprofile.config> | |||
|
|||
<version.smallrye.config>1.4.1</version.smallrye.config> |
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.
there's actually a newer 1.5.0 out, but the groupId changed to io.smallrye.config
It looks like several of these classes are what I would call "api" classes and others that are "spi". I'd recommend putting them in packages that align with their use, as it will make it easier to know what is a possible MP spec candidate addition down the road. So maybe |
@kenfinnigan yes I was structuring similarly to how for ex JSONB packages are structured. I put the API classes to While the (For JSONB there is So eventually we can have something like
What do you think ? |
I just wasn't sure whether Not sure if others have views. |
@kenfinnigan sure, I've just not seen I'll make sure the docs/README give a clear indication that the 'build' package is an API. And I would like Quarkus users give it a try for a couple of iterations (Quarkus docs will say it is an experimental API) before doing a submission. |
Put another way, if we're not wanting to have it be added to MP spec in the future why is it even an API? Maybe |
@kenfinnigan But we won't add in the If we do it then we'll be left with These are just interfaces at this stage in the |
It was mostly intended as a way to identify an API in amongst the implementation, but if that's not a concern then that's fine |
Just adding a quick +1 to clearly defined API/SPI - where a project is split across multiple packages public visibility becomes required to allow use across a project but from this it is not always clear what may be public API used elsewhere with any associated compatibility considerations. Having utilities for token generation in SmallRye and hopefully later within the specification defined APIs will be great - presently to write relatively simple getting started guides requires dependencies on other third party projects. |
@@ -0,0 +1,37 @@ | |||
package io.smallrye.jwt.build; |
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.
Do new classes to SmallRye projects require a copyright header or do these rely on a root LICENCE file now?
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.
@darranl on the root one AFAIK
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.
Yes, root LICENCE file
One other comment, has any consideration been given to immutability of intermediate Builder instances? Immutability can have a draw back that it may lead to intermediate instances being created and subsequently require garbage collection, however if a process was to use this API to issue many tokens a common builder could be initialised and shared across threads with those threads just adding their specifics without needing to repeat the common calls each time. |
@darranl sure, we were just discussing with Ken if adding an Re the immutability. Hmm... My preference at this stage would be to document that the builder instances are not thread safe and do not recommend caching a builder returned from |
FYI, |
Going ahead with wiring the encryption support since we'll eventually need to support the validation of the JWE encrypted tokens, microprofile/microprofile-jwt-auth#58 |
I'm going to close it and reopen as a draft as Ive completely rewamped the API |
Fixes #137
Example1:
Example2:
Example3:
Example4:
There are also many utility functions in
JwtSigningUtils
- where an existing JSON web token can be signed, etc