-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add OIDC client access token expires in skew #46222
Add OIDC client access token expires in skew #46222
Conversation
Michal, George approved so I added a I guess this is not a critical PR for the immediate backport but it would be worth having it in 3.18 eventually... I'm signing off now, good night, everyone :-) |
@sberyozkin I am happy to read it tomorrow (as I read all your PRs anyway, add me as a reviewer or not) but I just finished long day on QE stuff, so not today, thanks for keeping me in a loop, good night :-) |
This comment has been minimized.
This comment has been minimized.
🎊 PR Preview 046dc99 has been successfully built and deployed to https://quarkus-pr-main-46222-preview.surge.sh/version/main/guides/
|
This comment has been minimized.
This comment has been minimized.
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'm going to ask a stupid question but do we need an additional property?
From what I can see, you would have the same result by increasing expiresIn
a bit?
Interested in understanding why this is better!
Hi @gsmet It is a good question, thanks, that particular test was just easier for me to update to confirm adding the skew works - this test only checks that the calculated token expiry time is correct, indeed, in that particular setup it is not really necessary to configure 2 properties. There was a case reported by the Salesforce user where the standard So usually, the main use case, the relative We have tests which work with this Hope it clarifies it |
@gsmet, just for your info, #41067, the test which I updated was originally created to address that issue. You are right in this case the skew is unnecessary, but it is just the simplest test out there where I can check easily that configuring a skew impacts the test result :-) I guess I'll go ahead and merge later today unless yourself or Michal will have more comments |
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.
We also have quarkus.oidc.token.refresh-token-time-skew
so it makes sense to align this for access token.
As for suggestion that users can use access-token-expires-in
, there is a difference because source of expiresAt
can be:
- jwt claim expiration time
absolute-expires-in
config property- granted tokens 'expires-in'
for 1.
, now is not Quarkus server side now but identity provider now (when they created the tokens), 2.
is different completely. I saw a user scenario for this in the Zulip discussion.
@sberyozkin correct ^^ if I am wrong, but changes LGTM, thanks
extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientImpl.java
Outdated
Show resolved
Hide resolved
Michal, @michalvavrik, As for checking JWT claims - it is a fallback, only when no standard This is an optional property, if someone thinks it should be configured then they must have a reason for it, and it will be added to the calculated expiry time, irrespectively of what the source for the calculation was, IMHO it is reasonable, and lets us avoid some deep variations there :-) |
@michalvavrik Michal, I think I'll rename this property from |
Thank you @sberyozkin , you explanation is very helpful and it helps me to understand the situation. |
Thanks for the feedback, @michalvavrik |
ee96bdf
to
f9e2811
Compare
f9e2811
to
634819a
Compare
Sorry for the noise with pushes, so, Michal, @michalvavrik, I've renamed the property as suggested and simplified the JavaDocs definition to avoid sending a message one should only use it with the token grant response's Hope it is better now |
Status for workflow
|
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
Status for workflow
|
Fixes #46142.
This simple PR adds an OIDC client access token expires in property to let users get the correct token expiry time.
By default, the current time is added to the relative expires_in response property - however, due to the clock skew or the IDP specific configuration (as explained in the recent Zulip dev thread), the actual token issued at time can be earlier (or even later) than the current time. For example, a 1 min difference can be quite significant.
Adding an option to sync it with by configuring this new skew property (Duration can also be negative if needed) will let OIDC client calculate a more precise token expiry time.
I've confirmed that updated test is failing without adding a skew property.
If this PR does not make it to 3.18 right now then we might Guillaume to consider it for the backport to 3.18 later, we don't have to rush it if there are some concerns