-
Notifications
You must be signed in to change notification settings - Fork 245
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
refactor: TokenGenerationService takes key ID instead of PrivateKey #4395
refactor: TokenGenerationService takes key ID instead of PrivateKey #4395
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #4395 +/- ##
==========================================
+ Coverage 71.74% 74.94% +3.20%
==========================================
Files 919 1072 +153
Lines 18457 21455 +2998
Branches 1037 1172 +135
==========================================
+ Hits 13242 16080 +2838
- Misses 4756 4852 +96
- Partials 459 523 +64 ☔ View full report in Codecov by Sentry. |
bd06217
to
bc239d1
Compare
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.
LGTM, just a minor nit
spi/common/jwt-signer-spi/src/main/java/org/eclipse/edc/jwt/signer/spi/JwsSignerProvider.java
Outdated
Show resolved
Hide resolved
…gner/spi/JwsSignerProvider.java Co-authored-by: Enrico Risa <enrico.risa@gmail.com>
core/common/token-core/src/main/java/org/eclipse/edc/token/JwtGenerationService.java
Outdated
Show resolved
Hide resolved
spi/common/jwt-signer-spi/src/main/java/org/eclipse/edc/jwt/signer/spi/JwsSignerProvider.java
Outdated
Show resolved
Hide resolved
spi/common/jwt-signer-spi/src/main/java/org/eclipse/edc/jwt/signer/spi/JwsSignerProvider.java
Outdated
Show resolved
Hide resolved
...va/org/eclipse/edc/iam/identitytrust/sts/defaults/StsClientTokenIssuanceIntegrationTest.java
Outdated
Show resolved
Hide resolved
...va/org/eclipse/edc/iam/identitytrust/sts/defaults/StsClientTokenIssuanceIntegrationTest.java
Outdated
Show resolved
Hide resolved
…GenerationService.java Co-authored-by: ndr_brt <andrea.bertagnolli@gmail.com>
1820248
to
b76fcf0
Compare
c670e3f
to
90600fd
Compare
90600fd
to
70570fb
Compare
client -> new JwtGenerationService(keyId -> privateKeyResolver.resolvePrivateKey(keyId) | ||
.compose(pk -> Result.ofThrowable(() -> CryptoConverter.createSignerFor(pk)))), |
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.
this is the same as the one instantiated in the TokenServicesExtension
, it could be extracted in a separate class to avoid the duplication
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.
ah, clicked "merge" too fast. will do this in another PR down the line.
What this PR changes/adds
Refactors the
TokenGenerationService
to take aprivateKeyId
instead of aSupplier<PrivateKey>
. In addition, a new interfaceJwsSignerProvider
was added, that can be used to plug in customJWSSigner
implementations.If no custom impl is provided, a default
JWSSigner
is created, that resolves the private key from the vault, same as now.Why it does that
Being able to contribute a custom JWSSigner is a precondition for having tokens signed by a remote service, such as a HSM
Further notes
Do not review yet - this is just a PoC!
Linked Issue(s)
Closes # <-- insert Issue number if one exists
Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.