fix: support opaque access tokens #1459
Open
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.
Follow up to: #1084
This PR separates access tokens from id tokens, and removes overly-restrictive validation of them. As mentioned in #1084 (comment), the OAuth2 + OIDC specs do not require access tokens to be JWTs. This means that opaque tokens, which have no defined shape, are perfectly valid. Thus, it is a deviation from the spec to require them to be a JWT.
Further, this deviation from the spec blocks real-world use cases without much gain. While it is nice to check token validity on the client, this client-side check is inherently stale (e.g. revocations, TOCTOU diff, etc...). So graceful handling of said invalid token is probably desirable regardless?
Specific example / use-case:
Google uses exactly this opaque access token format. These access tokens can be used to authenticate agains GKE clusters. The current behavior blocks this use case unnecessarily.
I am aware of Google's
gcloudkubectl plugin. There are several reasons kubelogin is much preferable, including:gcloudcli + mass of python deps/components