pub trait TokenVerifier:
Send
+ Sync
+ 'static {
// Required method
fn verify(&self, token: &str) -> Result<TokenClaims, AuthError>;
}Expand description
Turns a raw bearer token string into validated claims.
Implementations are expected to hold the verification key (or call out
to an external validation service). libfw deliberately does not
ship a JWT implementation here so the choice stays framework-agnostic.
Required Methods§
Sourcefn verify(&self, token: &str) -> Result<TokenClaims, AuthError>
fn verify(&self, token: &str) -> Result<TokenClaims, AuthError>
Verify token and return its claims.
Should return AuthError::MissingToken for empty input,
AuthError::Invalid for unverifiable tokens and
AuthError::Expired for expired ones.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".