TokenInfo

The result of validating a bearer access token. A token validator returns this to the transport: valid gates the request, scopes/subject/claims describe the principal and are surfaced to tool handlers via RequestContext.auth, and audience lets the transport enforce the RFC 8707 resource binding ("tokens were issued specifically for them").

Members

Functions

hasAudience
bool hasAudience(string resource)

Whether the token lists the given resource among its audiences (RFC 8707). The spec (basic/authorization §Access Token Privilege Restriction) requires servers to "reject tokens that do not include them in the audience claim", so an empty audience does NOT satisfy the binding: a token must explicitly name resource to be treated as issued for this server.

hasScope
bool hasScope(string scope_)

Whether the token grants the named scope.

Static functions

invalid
TokenInfo invalid()

A convenience constructor for a rejected token.

Variables

audience
string[] audience;

the audiences the token was issued for (RFC 8707)

claims
Json claims;

the full claim set, for handler inspection

scopes
string[] scopes;

the scopes the token grants

subject
string subject;

the authenticated principal (token sub), if any

valid
bool valid;

true when the token is genuine, unexpired, and trusted