Quarkus OIDC: automatic token refresh for CodeAuthentication #29061
-
Hi Community, i experimented with the quarkus oidc plugin in my project where we need to use an internal oidc provider. In the initial Access Token Response the following tokens are included:
In the refresh access token response only
are delivered. When setting Is it right that quarkus relies on getting an id token in the refresh access token response? |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 11 replies
-
/cc @pedroigor, @sberyozkin |
Beta Was this translation helpful? Give feedback.
-
Hi @mqs24d If you have both I believe it is best to avoid trying to refresh tokens in your case, and instead try to experiment with a Does it help ? |
Beta Was this translation helpful? Give feedback.
-
Hi @sberyozkin I'm wondering about However, it is not required by the open id spec to return an ID token from the refresh endpoint: https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens
Due to this, our internal OIDC provider does not provide an ID Token and our internal frameworks depend on the introspection result of the access token to actually determine validity of the session. I wonder if it's possible to extend Quarkus to support this scenario? I'd be willing to help. |
Beta Was this translation helpful? Give feedback.
-
Hi @DCCSKrezovic The content of the access token is meant to be totally different to that of IdToken. Token refreshment is driven by the ID token's lifetime. RP-initiated, back-channel logout features are based on the presence of Note, for some providers like Github which are not really OIDC providers, we synthesize If, in your case, ID token is only relevant until it expires and afterwards you'd like to start using the access token instead of the id token, then I can suggest to consider doing what Renarde does when working with GitHub/etc - configure |
Beta Was this translation helpful? Give feedback.
-
@mqs24d I'd like to avoid using the information related to the access tokens for the state management which is centered around IdToken (or at the very least UserInfo) which represents a user authentication |
Beta Was this translation helpful? Give feedback.
-
Hi @sberyozkin, You say it's possible to use IdToken until it's expired ... But what about simply keeping the initial one in the SecurityIdentity somewhere? We still need to access the IdToken claims, our userinfo endpoint does not return everything IdToken provides. |
Beta Was this translation helpful? Give feedback.
-
I'm sorry, but while Or you can have a custom I'll take care though of NPE which happens when the RT grant request returns no ID token to make sure a synthesized ID token can be used |
Beta Was this translation helpful? Give feedback.
-
@sberyozkin one additional bug I may have found, but not sure if the approach I'm taking is right ... In the back channel logout handler, the ID Token is once more verified against the JWT provided by the back channel logout initiator. Is it possible to use dummy token, or to skip verification against ID token altogether? After all, checking the JWT against ID token is optional by OpenID spec. |
Beta Was this translation helpful? Give feedback.
-
@DCCSKrezovic, can you open please another discussion related to the back channel logout ? (IMHO it is the right thing to do, verify the logout token and ID token has been issued by the same issuer, etc, spec makes it optional but it is a Back channel callback provider's choice which Quarkus makes - not sure why you call it a bug) |
Beta Was this translation helpful? Give feedback.
-
@sberyozkin the backchannel issue is for the case when IdToken is not present, which is what this thread is about. That's why I call it a bug. It will simply throw a NPE, since claims required for verification are not present in the "internal" token. |
Beta Was this translation helpful? Give feedback.
Hi @mqs24d
Do you mean you have both
quarkus.oidc.token.refresh-expired=true
andquarkus.oidc.token.refresh-token-time-skew=some-duration
set ?If you only have
quarkus.oidc.token.refresh-expired=true
then it does mean that refreshing the tokens will only happen when the ID token has expired, it is really essential the refresh response contains a new ID token in this case since what we really want to do here is to extend the local session life-time and ID token represents it. We can't use the access token lifetime to extend the user session as the access token role is different to keeping the session.If you have both
quarkus.oidc.token.refresh-expired=true
andquarkus.oidc.token.refresh-…