pub enum AccessTokenFormat {
Opaque,
Jwt(Box<JwtConfig>),
}jwt only.Expand description
What the client receives as its access_token.
AccessTokenFormat::Opaque is the DEFAULT and is what this crate did before the jwt
feature existed: a 256-bit random string that means nothing without asking the AS. It is the
right default because it leaks nothing, is revocable in the only sense that matters (the AS
stops honouring it immediately), and costs one introspection call per protected request.
Since 0.9.2 a registered resource server can make that call itself
(crate::ServerConfig::resource_servers), so opaque is a real choice for a deployment with
resource servers rather than a client-only one. A deployment whose resource servers must
validate WITHOUT talking to the AS at all still wants AccessTokenFormat::Jwt.
Variants§
Opaque
Opaque random access tokens (RFC 7662 introspection reads them, for the token’s own client and for a resource server the token is addressed to).
Jwt(Box<JwtConfig>)
RFC 9068 at+jwt access tokens, signed with ES256. The record is still persisted, so
introspection and revocation continue to work on the exact string the client presents.
BOXED deliberately. JwtConfig carries a signing key, an audience and a jwks_uri, and
inlining that here put all of it in every crate::server::ServerConfig, which grew
AuthorizationServer from 656 to 856 bytes and tripped the size gate in
tests/allocation.rs. The box costs ONE allocation per server at construction, never per
request, and keeps the struct the same size for the opaque-token majority who pay for a
feature they did not enable otherwise. The gate caught this; raising the budget instead
would have made the gate meaningless.
Trait Implementations§
Source§impl Clone for AccessTokenFormat
impl Clone for AccessTokenFormat
Source§fn clone(&self) -> AccessTokenFormat
fn clone(&self) -> AccessTokenFormat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more