pub struct Identity { /* private fields */ }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.
Sourcepub fn property<T: Any + Debug + Send + Sync + 'static>(&self) -> Option<&T>
pub fn property<T: Any + Debug + Send + Sync + 'static>(&self) -> Option<&T>
Returns arbitrary property associated with this Identity.
Sourcepub fn ptr_eq(&self, other: &Identity) -> bool
pub fn ptr_eq(&self, other: &Identity) -> bool
Returns true if self and other share the same underlying identity data allocation.
Compares the Arc data-pointer (allocation identity), not the data contents: clones of
an Identity share their data allocation and compare equal, while independently built
Identity values compare unequal even when their contents are identical.
Trait Implementations§
Source§impl ResolveIdentity for Identity
impl ResolveIdentity for Identity
Source§fn resolve_identity<'a>(
&'a self,
_runtime_components: &'a RuntimeComponents,
_config_bag: &'a ConfigBag,
) -> IdentityFuture<'a> ⓘ
fn resolve_identity<'a>( &'a self, _runtime_components: &'a RuntimeComponents, _config_bag: &'a ConfigBag, ) -> IdentityFuture<'a> ⓘ
Source§fn cache_location(&self) -> IdentityCacheLocation
fn cache_location(&self) -> IdentityCacheLocation
Source§fn cache_partition(&self) -> Option<IdentityCachePartition>
fn cache_partition(&self) -> Option<IdentityCachePartition>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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 more