rskit-auth 0.2.0-alpha.1

JWT, OIDC, password hashing, and request-context auth helpers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use async_trait::async_trait;
use rskit_errors::AppResult;

/// Validates a bearer token and returns the extracted claims.
#[async_trait]
pub trait TokenValidator<C>: Send + Sync {
    /// Validate `token` and extract claims of type `C`.
    async fn validate(&self, token: &str) -> AppResult<C>;
}

/// Generates a signed bearer token from claims.
#[async_trait]
pub trait TokenGenerator<C>: Send + Sync {
    /// Sign `claims` and return the token string.
    async fn generate(&self, claims: &C) -> AppResult<String>;
}