You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce a CLI-owned Store interface for token storage (#5383)
## What is this about?
The CLI's token storage is currently shaped by the SDK's TokenCache
interface. That interface is internal to the SDK's user-to-machine (U2M)
login flow and only carries a bare OAuth token keyed by a string, so
there is no room to store anything alongside a token, and the CLI's
storage is coupled to an SDK type that exists specifically for U2M
login.
This PR introduces a CLI-owned `Store` interface (`Put`, `Lookup`,
`Delete`) over an explicit `Entry` envelope that wraps the token. A
small adapter, `ToU2MTokenCache`, presents a `Store` to the SDK at the
one place that still requires the SDK interface: passing a cache to
`u2m.PersistentAuth`. The file and keyring backends now implement
`Store`, and the OAuth helpers adapt it for the U2M paths.
This is a structural change with no behavior change. The `Entry` only
holds the token; the point is that it can now grow additional fields
without changing the interface or depending on the SDK. The first such
field will be a config checksum used to invalidate a cached token when
its profile changed, which arrives with a later change that adds caching
for machine-to-machine (M2M) and OIDC tokens.
**Naming note for reviewers:** the new interface is named Store to
distinguish the CLI's durable storage from the SDK's transient Cache.
The concrete types and helpers in this package are intentionally left in
the old vocabulary (fileTokenCache, keyringCache, and so on) in this PR
to keep the diff focused on the structural change. A follow-up PR will
take care of renaming.
## Testing
Existing auth unit and acceptance tests pass; there are no output or
behavior changes.
0 commit comments