Repository navigation
feat: request tokens with a JWT bearer assertion (RFC 7523) - #19
Merged
Merged
Conversation
The ID token claims are now passed to userinfo(), so Authlib rejects a response for another user (OIDC Core §5.3.2). A signed response that cannot be validated now shows an error instead of a server error.
Authlib 1.10 puts the kid of the key in the assertion header.
Per OIDC Discovery §4.3 and RFC 8414 §3.3, the issuer of the metadata must be the issuer URL the metadata was fetched with. A provider that gives another issuer, or none, is now refused.
The assertion is signed with the client key or the client secret, or pasted. The preview shows its header and claims, and decodes a pasted assertion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #2.
This adds the JWT bearer grant type (RFC 7523 §2.1) to the direct grants. The client sends a signed JWT that says who the tokens are for, and the provider issues tokens for this subject.
The assertion can be:
private_key_jwt,The form sets the subject, the issuer (the client ID by default), the audience (the issuer or the token endpoint), the lifetime and extra claims. The extra claims cannot replace the claims the form sets, except
jti.The preview shows the header and the claims as Authlib signs them. A pasted assertion is decoded without checking the signature, with its dates, and with a warning when it has expired or when its audience is neither the issuer nor the token endpoint.
When the token response has an ID token, it is checked before the tokens are kept, like for the password grant. The user of the ID token is then signed in. Otherwise, the page says who the tokens are for.