NAME

Uniform::HTTP::Auth::Bearer - HTTP Bearer authentication construction

SYNOPSIS

use Uniform::HTTP::Auth::Bearer;

my $value = Uniform::HTTP::Auth::Bearer->authorization(
    token => $token,
);

# Bearer eyJ...

DESCRIPTION

Uniform::HTTP::Auth::Bearer validates Bearer challenges and constructs Bearer authentication field values according to RFC 6750.

The token is opaque to this module. It does not decode JWTs, acquire or refresh OAuth tokens, validate token expiry, or determine authorization policy.

Most applications will use it through Uniform::HTTP::Auth. The direct API is available when a caller only needs Bearer field construction.

METHODS

validate_challenge

my $error = Uniform::HTTP::Auth::Bearer->validate_challenge($challenge);

Returns undef for a structurally usable Bearer challenge or a diagnostic string otherwise. Challenge parameters such as realm, scope, error, error_description, and error_uri remain available in the parsed challenge for callers and credential providers.

select_challenge

my $challenge = Uniform::HTTP::Auth::Bearer->select_challenge(\@bearer);

Returns the first usable Bearer challenge in wire order, or undef.

authorization

my $value = Uniform::HTTP::Auth::Bearer->authorization(
    token => $token,
);

Validates the token against the Bearer b64token syntax and returns the complete field value beginning with Bearer .

SECURITY NOTES

Bearer tokens are credentials: possession is normally sufficient to use them. Callers are responsible for obtaining, storing, transmitting, refreshing, and retiring tokens appropriately for their application and transport.

SEE ALSO

Uniform::HTTP::Auth, RFC 6750.

AUTHOR

Joshua S. Day, <HAX@cpan.org>

LICENSE

This software is released under the MIT License.