Skip to content
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: refresh token rotation #838

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

refactor: refresh token rotation #838

wants to merge 3 commits into from

Commits on Dec 4, 2024

  1. refactor: refresh token rotation interfaces

    Previously, the refresh token handler was using a combination of delete/update storage primitives. This made optimizing and implementing the refresh token handling difficult. Going forward, the RefreshTokenStorage must implement `RotateRefreshToken`. Token creation continues to be separated.
    
    BREAKING CHANGES:
    
    Method `RevokeRefreshTokenMaybeGracePeriod` was removed from `handler/fosite/TokenRevocationStorage`.
    
    Interface `handler/fosite/RefreshTokenStorage` has changed:
    
    - `CreateRefreshToken` now takes an additional argument `accessSignature` to keep track of refresh/access token pairs:
    - A new method `RotateRefreshToken` was added, which revokes old refresh tokens and associated access tokens:
    
    ```patch
    // handler/fosite/storage.go
    type RefreshTokenStorage interface {
    -	CreateRefreshTokenSession(ctx context.Context, signature string, request fosite.Requester) (err error)
    +	CreateRefreshTokenSession(ctx context.Context, signature string, accessSignature string, request fosite.Requester) (err error)
    
    	GetRefreshTokenSession(ctx context.Context, signature string, session fosite.Session) (request fosite.Requester, err error)
    	DeleteRefreshTokenSession(ctx context.Context, signature string) (err error)
    
    +	RotateRefreshToken(ctx context.Context, requestID string, refreshTokenSignature string) (err error)
    }
    ```
    aeneasr committed Dec 4, 2024
    Configuration menu
    Copy the full SHA
    c4fe21c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b57570a View commit details
    Browse the repository at this point in the history

Commits on Dec 11, 2024

  1. ci: pin hydra version

    aeneasr committed Dec 11, 2024
    Configuration menu
    Copy the full SHA
    57cf545 View commit details
    Browse the repository at this point in the history