authly_common/
access_token.rs

1//! Types defining authly access token.
2
3use fnv::FnvHashSet;
4use serde::{Deserialize, Serialize};
5
6use crate::id::{AttrId, EntityId};
7
8/// Claims for the Authly Access Token JWT
9#[derive(Serialize, Deserialize, Debug)]
10pub struct AuthlyAccessTokenClaims {
11    /// Issued at.
12    ///
13    /// Authly may publish a Reset event which invalidates all tokens issued in the past.
14    pub iat: i64,
15
16    /// Expiration time
17    pub exp: i64,
18
19    /// Authy claims
20    pub authly: Authly,
21}
22
23/// The authly claim.
24#[derive(Serialize, Deserialize, Debug)]
25pub struct Authly {
26    /// The [EntityId] of the entity the access token was issued for.
27    pub entity_id: EntityId,
28
29    /// The entity attributes at the time the token was issued.
30    pub entity_attributes: FnvHashSet<AttrId>,
31}