cp-core 0.3.39

Core utilities for SimpleG
Documentation
/*
 * Copyright (c) Gabriel Amihalachioaie, SimpleG 2023.
 */

use crate::auth::jwt_token::JwtToken;
use crate::error::Error;

pub trait TokenValidator {
    ///
    /// Validates the specified token.
    ///
    /// # Arguments
    ///
    /// * `token` - Token to be validated.
    ///
    /// # Returns
    ///
    /// * `Ok` - Token.
    /// * `Err` - Error if the validation has failed.
    /// Having the error kind valued as `INVALID_TOKEN` if the token is invalid.
    fn validate(&self, token: &str) -> Result<JwtToken, Error>;
}