pub struct Identity { /* private fields */ }Expand description
Who the current request is, plus whatever claims came with them.
Implementations§
Source§impl Identity
impl Identity
pub fn new(subject: impl Into<String>) -> Self
Sourcepub fn with_claim(
self,
name: impl Into<String>,
value: impl Into<Value>,
) -> Self
pub fn with_claim( self, name: impl Into<String>, value: impl Into<Value>, ) -> Self
Attach a claim. Reserved names (sub, exp, iat) are set by the
signer and cannot be overridden here.
pub fn subject(&self) -> &str
pub fn claim<T: DeserializeOwned>(&self, name: &str) -> Result<Option<T>>
pub fn claims(&self) -> &Map<String, Value>
Trait Implementations§
impl StructuralPartialEq for Identity
Auto Trait Implementations§
impl Freeze for Identity
impl RefUnwindSafe for Identity
impl Send for Identity
impl Sync for Identity
impl Unpin for Identity
impl UnsafeUnpin for Identity
impl UnwindSafe for Identity
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