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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more