pub struct AuthUser {
pub subject: String,
pub tenant_id: Option<String>,
pub role: String,
pub permissions: Vec<String>,
pub attributes: HashMap<String, String>,
}Expand description
An authenticated principal. Vendor-neutral: every concept here (subject, tenancy, role, permissions, free-form attributes) maps cleanly to JWT claims, OAuth profiles, LDAP records, and custom auth stores.
attributes is the escape hatch for provider-specific data
(OAuth ID-token claims, group memberships, etc.) so the trait
itself never grows vendor-specific fields.
Fields§
§subject: StringStable unique identifier for the user within this provider.
tenant_id: Option<String>Tenant scope, if the deployment is multi-tenant.
role: StringPrimary role (e.g. "admin", "editor"). Empty string = no role.
permissions: Vec<String>Fine-grained permissions (e.g. ["read:posts", "write:posts"]).
attributes: HashMap<String, String>Provider-opaque extra claims. Deliberately String values so the
shape round-trips through any serialisation format.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AuthUser
impl<'de> Deserialize<'de> for AuthUser
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AuthUser
impl RefUnwindSafe for AuthUser
impl Send for AuthUser
impl Sync for AuthUser
impl Unpin for AuthUser
impl UnsafeUnpin for AuthUser
impl UnwindSafe for AuthUser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more