pub struct CredentialMetadata {
pub client_id: Option<String>,
pub scopes: Vec<String>,
pub user_agent: Option<String>,
pub client_ip: Option<String>,
pub custom: HashMap<String, String>,
}Expand description
Additional credential metadata that can be attached to any credential type.
Use the builder methods to construct metadata fluently:
let meta = CredentialMetadata::new()
.client_id("my-app")
.client_ip("10.0.0.1")
.scope("read")
.scope("write");Fields§
§client_id: Option<String>Client identifier (for OAuth flows).
scopes: Vec<String>Requested scopes (e.g. ["read", "write"]).
user_agent: Option<String>User-Agent string from the HTTP request, if available.
client_ip: Option<String>IP address of the authenticating client, if available.
custom: HashMap<String, String>Additional custom metadata key-value pairs.
Implementations§
Source§impl CredentialMetadata
impl CredentialMetadata
Sourcepub fn scope(self, scope: impl Into<String>) -> Self
pub fn scope(self, scope: impl Into<String>) -> Self
Append a single scope to the requested scopes.
Sourcepub fn scopes(self, scopes: Vec<String>) -> Self
pub fn scopes(self, scopes: Vec<String>) -> Self
Replace the requested scopes with the given list.
Sourcepub fn user_agent(self, user_agent: impl Into<String>) -> Self
pub fn user_agent(self, user_agent: impl Into<String>) -> Self
Set the User-Agent header value from the HTTP request.
Trait Implementations§
Source§impl Clone for CredentialMetadata
impl Clone for CredentialMetadata
Source§fn clone(&self) -> CredentialMetadata
fn clone(&self) -> CredentialMetadata
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 CredentialMetadata
impl Debug for CredentialMetadata
Source§impl Default for CredentialMetadata
impl Default for CredentialMetadata
Source§fn default() -> CredentialMetadata
fn default() -> CredentialMetadata
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CredentialMetadata
impl<'de> Deserialize<'de> for CredentialMetadata
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 CredentialMetadata
impl RefUnwindSafe for CredentialMetadata
impl Send for CredentialMetadata
impl Sync for CredentialMetadata
impl Unpin for CredentialMetadata
impl UnsafeUnpin for CredentialMetadata
impl UnwindSafe for CredentialMetadata
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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§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 more