[DRAFT] [OIDC 17] Add token API for trading bearer token for API key #10308
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.
I will wait on merging this PR until more validation and review is done.
Progress on #10212.
Depends on #10306.
This adds a new token API for trading a bearer token for an API key.
A sample request is this:
A sample response is this:
The endpoint expects no other existing auth mechanism (no cookie auth, no API key auth) and will reject the request if present.
In the future, the full
/api/v2/token
URL will be discovered by the client via a new resource in the service index. For now, it will be hard coded in custom client scripts.The
{OIDC token}
in the request message will be an Entra ID token for a service principal. In the future this can be more token types such as GitHub Actions OIDC tokens.The
username
is the username of the trust policy’s controlling user, NOT the package owner scope. This aligns with the current API key design where API keys are only owned by users but can be scoped to either users or organizations. I am not confident on this decision but given this is a "closed beta" feature, we can try it and see how it goes, and change later with minimum disruption.