Repository navigation
Conversation
Adds a bearer module behind the server feature: a challenge builder for RFC 6750 section 3 (plus RFC 9728's resource_metadata), the three RFC 6750 error codes, and token parsing from Authorization: Bearer.
bearer::Client reads Bearer challenges and bearer::encode_credentials sends the token. Client and ChallengeBuilder share one table of the RFC 6750 and RFC 9728 parameters and their rules. error_uri and resource_metadata are checked against the RFC 3986 URI grammar, fuzzed against iri-string.
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.
This adds a
bearermodule next tobasicanddigest, covering both sides of RFC 6750.On the client side,
bearer::Clientreads aBearerchallenge, includingresource_metadatafrom RFC 9728, which OAuth clients use to find the authorization server.respond(orbearer::encode_credentials) produces theAuthorizationvalue. It has no feature flag and no dependencies.On the server side, behind
server,bearer::ChallengeBuilderwrites the challenge,bearer::ErrorCodecovers the three RFC 6750 errors and their status codes, andbearer::Credentials::parsetakes the token out ofAuthorization: Bearer ...using the sameCredentialsSourcetypes as the Basic parser.Both sides use the same table of parameters and rules, so anything the builder writes the client accepts. The rules follow RFC 6750 section 3 and RFC 6749 appendix A in full: at least one parameter, no repeats, the scope and error character sets,
error_urias an absolute URI, andresource_metadataas an https URI with a host and no fragment. The URI check is a small RFC 3986 parser; a new fuzz target,bearer_uri, compares it againstiri-string.The
servermodule used to needbasic-schemeordigest-schemeas well; it now builds withserveralone. The design note and the RFC text it follows are indesign/20261023-bearer.mdanddesign/20261023-bearer-rfc.md.