Skip to content

Implement UpstreamTokenService #3916

Closed

Description

@jhrozek

Summary

New service package that owns upstream token lifecycle: read, refresh, and error handling.

What

New package pkg/authserver/upstreamtoken/ with:

  • Service interface — single method GetValidTokens(ctx, sessionID) returning an opaque UpstreamCredential
  • inProcessService implementation — on-read refresh using the existing upstream.OAuth2Provider.RefreshTokens(), singleflight deduplication, error classification (permanent vs transient), session revocation on permanent upstream failure
  • Sentinel errors for session not found, refresh failed, no refresh token

Why

The middleware should call a service-level interface, not raw storage. This abstraction represents the business operation and can be exposed over the network when the auth server moves out-of-process.

Activity

  1. added
    enhancement
    size/L
    on Feb 20, 2026
  2. self-assigned this
    on Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

authenticationenhancementsize/L

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions