barrel_mcp_auth_bearer (barrel_mcp v2.0.2)
View SourceBearer token authentication provider for barrel_mcp.
Supports JWT validation (HS256 built-in, RS256/ES256 via custom verifier), opaque tokens, and standard claims validation (iss, aud, exp, nbf).
Configuration Options
verifier- Custom verification function for tokenssecret- HMAC secret for HS256 JWT validationissuer- Expected issuer (iss claim)audience- Expected audience (aud claim)clock_skew- Allowed clock skew in seconds (default: 60)scope_claim- Claim name for scopes (default: scope)realm- Realm for WWW-Authenticate headerresource- Resource identifier for RFC 8707
See also: barrel_mcp_auth.
Summary
Functions
Authenticate a request using Bearer token.
Generate a WWW-Authenticate challenge.
Decode a JWT without verification. Returns {ok, Header, Claims, Signature} or {error, Reason}.
Initialize the Bearer token provider.
Validate JWT claims.
Verify HS256 signature.
Functions
-spec authenticate(map(), map()) -> {ok, barrel_mcp_auth:auth_info()} | {error, barrel_mcp_auth:auth_error()}.
Authenticate a request using Bearer token.
-spec challenge(barrel_mcp_auth:auth_error(), map()) -> {integer(), map(), binary()}.
Generate a WWW-Authenticate challenge.
Decode a JWT without verification. Returns {ok, Header, Claims, Signature} or {error, Reason}.
Initialize the Bearer token provider.
Validate JWT claims.
Verify HS256 signature.