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 new(sub: impl Into<String>) -> UserClaims
pub fn new(sub: impl Into<String>) -> UserClaims
Creates new user claims with the given subject.
Sourcepub fn with_name(self, name: impl Into<String>) -> UserClaims
pub fn with_name(self, name: impl Into<String>) -> UserClaims
Sets the user’s full name.
Sourcepub fn with_email(self, email: impl Into<String>) -> UserClaims
pub fn with_email(self, email: impl Into<String>) -> UserClaims
Sets the user’s email.
Sourcepub fn with_email_verified(self, verified: bool) -> UserClaims
pub fn with_email_verified(self, verified: bool) -> UserClaims
Sets whether the email is verified.
Sourcepub fn with_preferred_username(self, username: impl Into<String>) -> UserClaims
pub fn with_preferred_username(self, username: impl Into<String>) -> UserClaims
Sets the user’s preferred username.
Sourcepub fn with_picture(self, url: impl Into<String>) -> UserClaims
pub fn with_picture(self, url: impl Into<String>) -> UserClaims
Sets the user’s profile picture URL.
Sourcepub fn with_given_name(self, name: impl Into<String>) -> UserClaims
pub fn with_given_name(self, name: impl Into<String>) -> UserClaims
Sets the user’s given name.
Sourcepub fn with_family_name(self, name: impl Into<String>) -> UserClaims
pub fn with_family_name(self, name: impl Into<String>) -> UserClaims
Sets the user’s family name.
Sourcepub fn with_phone_number(self, phone: impl Into<String>) -> UserClaims
pub fn with_phone_number(self, phone: impl Into<String>) -> UserClaims
Sets the user’s phone number.
Sourcepub fn with_updated_at(self, timestamp: i64) -> UserClaims
pub fn with_updated_at(self, timestamp: i64) -> UserClaims
Sets the updated_at timestamp.
Sourcepub fn with_custom(self, key: impl Into<String>, value: Value) -> UserClaims
pub fn with_custom(self, key: impl Into<String>, value: Value) -> UserClaims
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<UserClaims, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<UserClaims, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for UserClaims
impl Serialize for UserClaims
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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