pub struct AuthIdentity {
pub subject: String,
pub roles: Vec<String>,
pub claims: BTreeMap<String, Value>,
}Fields§
§subject: String§roles: Vec<String>§claims: BTreeMap<String, Value>Implementations§
Source§impl AuthIdentity
impl AuthIdentity
pub fn new(subject: impl Into<String>) -> Self
pub fn with_roles<I, S>(self, roles: I) -> Self
pub fn with_claim(self, key: impl Into<String>, value: Value) -> Self
pub fn has_role(&self, role: &str) -> bool
pub fn require_role(&self, role: &str) -> Result<(), HttpException>
Trait Implementations§
Source§impl Clone for AuthIdentity
impl Clone for AuthIdentity
Source§fn clone(&self) -> AuthIdentity
fn clone(&self) -> AuthIdentity
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 AuthIdentity
impl Debug for AuthIdentity
Source§impl Default for AuthIdentity
impl Default for AuthIdentity
Source§fn default() -> AuthIdentity
fn default() -> AuthIdentity
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for AuthIdentity
impl<'de> Deserialize<'de> for AuthIdentity
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 AuthIdentity
impl RefUnwindSafe for AuthIdentity
impl Send for AuthIdentity
impl Sync for AuthIdentity
impl Unpin for AuthIdentity
impl UnsafeUnpin for AuthIdentity
impl UnwindSafe for AuthIdentity
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