pub struct AuthContext {
pub tenant_id: String,
pub permissions: Vec<String>,
pub authenticated_at: DateTime<Utc>,
}Expand description
Authentication context for a session
Fields§
§tenant_id: String§permissions: Vec<String>§authenticated_at: DateTime<Utc>Implementations§
Source§impl AuthContext
impl AuthContext
Sourcepub fn new(tenant_id: String, permissions: Vec<String>) -> Self
pub fn new(tenant_id: String, permissions: Vec<String>) -> Self
Create a new authentication context
Sourcepub fn has_permission(&self, permission: &str) -> bool
pub fn has_permission(&self, permission: &str) -> bool
Check if the context has a specific permission
Sourcepub fn is_authenticated_to(&self, tenant_id: &str) -> bool
pub fn is_authenticated_to(&self, tenant_id: &str) -> bool
Check if authenticated to a specific tenant
Trait Implementations§
Source§impl Clone for AuthContext
impl Clone for AuthContext
Source§fn clone(&self) -> AuthContext
fn clone(&self) -> AuthContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuthContext
impl RefUnwindSafe for AuthContext
impl Send for AuthContext
impl Sync for AuthContext
impl Unpin for AuthContext
impl UnsafeUnpin for AuthContext
impl UnwindSafe for AuthContext
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