bearer_token
Extracts the token from an Authorization: Bearer <token> header value.
Follows RFC 7235 and RFC 6750: the scheme name is case-insensitive, it is followed by one or
more spaces, and the token is a non-empty b64token (letters, digits and - . _ ~ +
/, optionally ending with = padding). Leading and trailing spaces or tabs around the whole
value are ignored. Anything else, including another scheme or an empty token, gives None.
Only the syntax is checked: whether the token is valid is up to the caller.
Import
Section titled “Import”Cargo feature http (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
header | &str | The value of an Authorization header. |
Returns
Section titled “Returns”Option<&str>
