pub struct AuthContext {
pub user_id: Option<String>,
pub scopes: Vec<String>,
pub claims: Option<TokenClaims>,
pub auth_method: AuthMethod,
pub is_authenticated: bool,
}Expand description
Authentication context for requests
Fields§
§user_id: Option<String>§scopes: Vec<String>§claims: Option<TokenClaims>§auth_method: AuthMethod§is_authenticated: boolImplementations§
Source§impl AuthContext
impl AuthContext
pub fn new() -> AuthContext
pub fn with_user_id(self, user_id: String) -> AuthContext
pub fn with_scopes(self, scopes: Vec<String>) -> AuthContext
pub fn with_claims(self, claims: TokenClaims) -> AuthContext
pub fn with_auth_method(self, auth_method: AuthMethod) -> AuthContext
pub fn authenticated(self) -> AuthContext
pub fn has_scope(&self, scope: &str) -> bool
pub fn has_any_scope(&self, scopes: &[String]) -> bool
pub fn has_all_scopes(&self, scopes: &[String]) -> bool
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 moreSource§impl Debug for AuthContext
impl Debug for AuthContext
Source§impl Default for AuthContext
impl Default for AuthContext
Source§fn default() -> AuthContext
fn default() -> AuthContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AuthContext
impl !RefUnwindSafe for AuthContext
impl Send for AuthContext
impl Sync for AuthContext
impl Unpin 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