cp-core 0.3.39

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

use std::collections::HashMap;
use std::fmt::{Debug, Formatter};

use jsonwebtoken::TokenData;
use serde_json::Value;

#[derive(Clone)]
pub struct JwtToken {
    token_data: TokenData<HashMap<String, Value>>,
}

impl JwtToken {
    pub fn new(token_data: TokenData<HashMap<String, Value>>) -> Self {
        Self { token_data }
    }

    pub fn token_data(&self) -> &TokenData<HashMap<String, Value>> {
        &self.token_data
    }
}

impl Debug for JwtToken {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        f.write_str(format!("{:?}", self.token_data).as_str())
    }
}