pub struct Identity { /* private fields */ }
Available on crate feature
client
only.Expand description
An identity that can be used for authentication.
The Identity
is a container for any arbitrary identity data that may be used
by a Sign
implementation. Under the hood, it
has an Arc<dyn Any>
, and it is the responsibility of the signer to downcast
to the appropriate data type using the data()
function.
The Identity
also holds an optional expiration time, which may duplicate
an expiration time on the identity data. This is because an Arc<dyn Any>
can’t be downcast to any arbitrary trait, and expiring identities are
common enough to be built-in.
Implementations§
Source§impl Identity
impl Identity
Sourcepub fn new<T>(data: T, expiration: Option<SystemTime>) -> Self
pub fn new<T>(data: T, expiration: Option<SystemTime>) -> Self
Creates a new identity with the given data and expiration time.
Sourcepub fn data<T: Any + Debug + Send + Sync + 'static>(&self) -> Option<&T>
pub fn data<T: Any + Debug + Send + Sync + 'static>(&self) -> Option<&T>
Returns the raw identity data.
Sourcepub fn expiration(&self) -> Option<SystemTime>
pub fn expiration(&self) -> Option<SystemTime>
Returns the expiration time for this identity, if any.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Identity
impl !RefUnwindSafe for Identity
impl Send for Identity
impl Sync for Identity
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.