pub struct Principal { /* private fields */ }Expand description
The caller authenticated by an access token.
Implementations§
Source§impl Principal
impl Principal
Sourcepub fn new(subject: impl Into<String>) -> Self
pub fn new(subject: impl Into<String>) -> Self
A principal identified by subject (the token’s sub).
Sourcepub fn with_issuer(self, issuer: impl Into<String>) -> Self
pub fn with_issuer(self, issuer: impl Into<String>) -> Self
Sets the token issuer.
Sourcepub fn with_scopes<I, S>(self, scopes: I) -> Self
pub fn with_scopes<I, S>(self, scopes: I) -> Self
Sets the granted scopes.
Sourcepub fn with_claims(self, claims: Map<String, Value>) -> Self
pub fn with_claims(self, claims: Map<String, Value>) -> Self
Sets the other claims of the token.
Sourcepub fn has_scope(&self, scope: &str) -> bool
pub fn has_scope(&self, scope: &str) -> bool
Whether scope was granted (exactly; see
OAuthBuilder::scope_implies
for hierarchies).
Trait Implementations§
impl StructuralPartialEq for Principal
Auto Trait Implementations§
impl Freeze for Principal
impl RefUnwindSafe for Principal
impl Send for Principal
impl Sync for Principal
impl Unpin for Principal
impl UnsafeUnpin for Principal
impl UnwindSafe for Principal
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