Expand description
JWT authentication and authorization. JWT authentication middleware and token management.
Structs§
- Authenticated
Agent - Claims
- JWT claims embedded in every token.
- Token
Options - Extra claims for
create_token_with. - Token
Policy - Rules a token must meet beyond a valid signature.
- Token
Request - Request body for the token generation endpoint.
- Token
Verifier - How bearer tokens are checked.
Enums§
- Scope
- What a token may do. Levels are ordered: each includes the ones before it.
Functions§
- admin_
authorized - Authorize an admin request from request headers against the configured admin
key. Errors if no admin key is configured (admin endpoints are disabled) or the
provided
x-api-key/ bearer does not match. Used by the /v1/admin endpoints. - auth_
middleware - Middleware that enforces JWT auth when a secret is configured.
- create_
scoped_ token - Create a signed JWT limited to
dbs(all whenNone). - create_
token - Create a signed JWT for the given agent.
- create_
token_ with - Create a signed HS256 JWT with every optional claim.
- generate_
token - glob_
match - Whether
textmatchespattern, where*in the pattern matches any run of characters (including none) and everything else matches itself.