Skip to main content

TokenVerifier

Trait TokenVerifier 

Source
pub trait TokenVerifier:
    Send
    + Sync
    + 'static {
    // Required method
    fn verify(&self, token: &str) -> Result<Principal, AuthError>;
}
Expand description

Verifies an opaque bearer token minted by an external issuer.

This is the seam for OIDC/JWT and similar: a real implementation validates a signature against a JWKS (or introspects the token with the issuer) and maps verified claims onto a Principal. The spike ships only the trait so the dependency choice and network calls stay out of this crate; a concrete verifier lives behind a feature flag in a later milestone.

Required Methods§

Source

fn verify(&self, token: &str) -> Result<Principal, AuthError>

Verifies token and derives a principal from its claims.

§Errors

Returns AuthError::Unauthenticated for a malformed, expired, or untrusted token.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§