Repository navigation
feat(client/dockerhub): add UserSession expiry helpers - #689
Merged
Merged
Conversation
SDK consumers need to know whether a Docker Hub access token has expired, or is about to, before using it. Add Expired and ExpiresWithin methods on dockerhub.UserSession so callers can check expiry with an early-expiry window instead of comparing Claims.ExpiresAt themselves. Sessions without an ExpiresAt claim report as expired. Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Benehiko
force-pushed
the
feat/dockerhub-session-expiry
branch
from
October 12, 2026 13:06
9c88969 to
ddbb728
Compare
Benehiko
marked this pull request as ready for review
October 12, 2026 13:09
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
Benehiko
enabled auto-merge
October 12, 2026 13:12
joe0BAB
reviewed
Oct 12, 2026
joe0BAB
approved these changes
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds expiry helpers to
dockerhub.UserSessionso SDK consumers can check whether a Docker Hub access token has expired, or will expire soon (early expiry), before using it.Claims.ExpiresAtcompared againsttime.Now().expclaim is reported as expired, so callers refresh rather than trust an unknown expiry.Open question
Should a session without claims instead fall back to reading
expfrom the (unverified) JWT payload inAccessToken? Happy to add that if preferred.Testing
TestUserSessionExpirycovering valid, within-leeway, expired, negative leeway, missing/zeroexp, and the existing wire fixture.