Update quarkus-oidc-token-propagation to better work with JWT tokens and update smalrye-jwt to 2.4.4 #15606
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #15387.
Fixes #14798.
This PR has proved a bit more complex to finalize than I expected but it starts in the direction of avoiding the direct token propagation, for now with JWT-formatted tokens and in fact is quite simple. Here is what it does:
quarkus-oidc-token-propagation
now depends only on the MP JWT API andquarkus-security
- it was a mistake to make it pullquarkus-oidc
- as it means that for KC tokens verified byquarkus-smallrye-jwt
could not be propagated. The other problem was it would not start if Keycloak were not available (as reported by @tqvarnst)AccessTokenRequestFilter
which propagates the tokens has been updated to acceptInstance<TokenCredential>
because 1)AccessTokenCredential
is part ofquarkus-oidc
and withoutInstance
it would not start if neitherquarkus-smallrye-jwt
norquarkus-oidc
were availablequarkus-smallrye-jwt
to ensure it can work withAccessTokenCredential
by producingTokenCredential
quarkus-oidc
to ensureAccessTokenCredential
is preferred toIdTokenCredential
for theTokenCredential
injectionsmallrye-jwt
version to2.4.4
as it contains a fix required for this PRJsonWebTokenRequestFilter
it can be registered same asAccessTokenRequestFilter
, either for the specific clients or for all the clientsintegration-tests/oidc-token-propagation
(which usesquarkus-oidc
) to ensure both filters can handle the tokensintegration-tests/smallrye-jwt-token-propagation
test - this is the first integration test which will stress both the server and clientsmallrye-jwt
code in the native mode - and here it is tested howsmallrye-jwt
can use Keycloak certs to verify its tokens and to show howJsonWebTokenRequestFilter
can update these tokens with the newissuer
andaudience
and re-sign (or later - sign/encrypt).After this PR the next step would be to use a Keycloak token exchange grant to support exchanging the tokens via Keycloak