Skip to main content

framework_cqrs_lib/cqrs/infra/token/
jwt_claims.rs

1use std::collections::HashMap;
2
3use chrono::Utc;
4use serde::{Deserialize, Serialize};
5
6use crate::cqrs::core::context::Context;
7
8impl From<JwtClaims> for Context {
9    fn from(value: JwtClaims) -> Self {
10        Self {
11            subject: value.sub,
12            now: Utc::now(),
13            meta: HashMap::new(),
14            filters: HashMap::new(),
15        }
16    }
17}
18
19#[derive(Serialize, Deserialize, Clone, Debug)]
20pub struct JwtClaims {
21    pub sub: String,
22    pub exp: u64,
23}