oauth2_broker/auth/token/
family.rs

1//! Token family classification helpers (tenant/principal/provider).
2
3// self
4use crate::{
5	_prelude::*,
6	auth::{PrincipalId, ProviderId, TenantId},
7};
8
9/// Identifies a cohesive token family for a tenant/principal/provider tuple.
10#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
11pub struct TokenFamily {
12	/// Tenant identifier tied to all tokens in the family.
13	pub tenant: TenantId,
14	/// Principal identifier associated with the family.
15	pub principal: PrincipalId,
16	/// Optional provider identifier that minted the tokens.
17	pub provider: Option<ProviderId>,
18}
19impl TokenFamily {
20	/// Creates a family for the provided tenant and principal.
21	pub fn new(tenant: TenantId, principal: PrincipalId) -> Self {
22		Self { tenant, principal, provider: None }
23	}
24}