pub trait JwtVerifier<S> {
    fn claims<C>(&self) -> Result<C>
    where
        C: 'static + DeserializeOwned
;
fn verify<C>(&mut self, validation: &Validation) -> Result<C>
    where
        C: 'static + DeserializeOwned
; }
This is supported on crate feature jwt only.
Expand description

A context extension. This extension must be used in downstream of middleware guard or guard_by, otherwise you cannot get expected claims.

Example

use roa::{Context, Result};
use roa::jwt::JwtVerifier;
use serde_json::Value;

async fn get(ctx: &mut Context) -> Result {
    let claims: Value = ctx.claims()?;
    Ok(())
}

Required methods

Deserialize claims from token.

Verify token and deserialize claims with a validation. Use this method if this validation is different from that one of JwtGuard.

Implementors