pub struct UserClaims {Show 21 fields
pub sub: String,
pub name: Option<String>,
pub given_name: Option<String>,
pub family_name: Option<String>,
pub middle_name: Option<String>,
pub nickname: Option<String>,
pub preferred_username: Option<String>,
pub profile: Option<String>,
pub picture: Option<String>,
pub website: Option<String>,
pub gender: Option<String>,
pub birthdate: Option<String>,
pub zoneinfo: Option<String>,
pub locale: Option<String>,
pub updated_at: Option<i64>,
pub email: Option<String>,
pub email_verified: Option<bool>,
pub phone_number: Option<String>,
pub phone_number_verified: Option<bool>,
pub address: Option<AddressClaim>,
pub custom: HashMap<String, Value>,
}Expand description
Standard OpenID Connect user claims.
These claims describe the authenticated user and are included in ID tokens and returned from the userinfo endpoint.
Fields§
§sub: StringSubject identifier (required, unique user ID).
name: Option<String>User’s full name.
given_name: Option<String>User’s given/first name.
family_name: Option<String>User’s family/last name.
middle_name: Option<String>User’s middle name.
nickname: Option<String>User’s nickname/username.
preferred_username: Option<String>User’s preferred username.
profile: Option<String>URL of user’s profile page.
picture: Option<String>URL of user’s profile picture.
website: Option<String>URL of user’s website.
gender: Option<String>User’s gender.
birthdate: Option<String>User’s birthday (ISO 8601 date).
zoneinfo: Option<String>User’s timezone (IANA timezone string).
locale: Option<String>User’s locale (BCP47 language tag).
updated_at: Option<i64>Time the user’s info was last updated (Unix timestamp).
email: Option<String>User’s email address.
email_verified: Option<bool>Whether the email has been verified.
phone_number: Option<String>User’s phone number.
phone_number_verified: Option<bool>Whether the phone number has been verified.
address: Option<AddressClaim>User’s address (JSON object).
custom: HashMap<String, Value>Additional custom claims.
Implementations§
Source§impl UserClaims
impl UserClaims
Sourcepub fn with_email(self, email: impl Into<String>) -> Self
pub fn with_email(self, email: impl Into<String>) -> Self
Sets the user’s email.
Sourcepub fn with_email_verified(self, verified: bool) -> Self
pub fn with_email_verified(self, verified: bool) -> Self
Sets whether the email is verified.
Sourcepub fn with_preferred_username(self, username: impl Into<String>) -> Self
pub fn with_preferred_username(self, username: impl Into<String>) -> Self
Sets the user’s preferred username.
Sourcepub fn with_picture(self, url: impl Into<String>) -> Self
pub fn with_picture(self, url: impl Into<String>) -> Self
Sets the user’s profile picture URL.
Sourcepub fn with_given_name(self, name: impl Into<String>) -> Self
pub fn with_given_name(self, name: impl Into<String>) -> Self
Sets the user’s given name.
Sourcepub fn with_family_name(self, name: impl Into<String>) -> Self
pub fn with_family_name(self, name: impl Into<String>) -> Self
Sets the user’s family name.
Sourcepub fn with_phone_number(self, phone: impl Into<String>) -> Self
pub fn with_phone_number(self, phone: impl Into<String>) -> Self
Sets the user’s phone number.
Sourcepub fn with_updated_at(self, timestamp: i64) -> Self
pub fn with_updated_at(self, timestamp: i64) -> Self
Sets the updated_at timestamp.
Sourcepub fn with_custom(self, key: impl Into<String>, value: Value) -> Self
pub fn with_custom(self, key: impl Into<String>, value: Value) -> Self
Adds a custom claim.
Sourcepub fn filter_by_scopes(&self, scopes: &[String]) -> UserClaims
pub fn filter_by_scopes(&self, scopes: &[String]) -> UserClaims
Filters claims based on requested scopes.
Only returns claims that are allowed by the given scopes.
Trait Implementations§
Source§impl Clone for UserClaims
impl Clone for UserClaims
Source§fn clone(&self) -> UserClaims
fn clone(&self) -> UserClaims
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UserClaims
impl Debug for UserClaims
Source§impl Default for UserClaims
impl Default for UserClaims
Source§fn default() -> UserClaims
fn default() -> UserClaims
Source§impl<'de> Deserialize<'de> for UserClaims
impl<'de> Deserialize<'de> for UserClaims
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>,
Auto Trait Implementations§
impl Freeze for UserClaims
impl RefUnwindSafe for UserClaims
impl Send for UserClaims
impl Sync for UserClaims
impl Unpin for UserClaims
impl UnsafeUnpin for UserClaims
impl UnwindSafe for UserClaims
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
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>
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