pub struct UserProfile {
pub id: Option<String>,
pub provider: Option<String>,
pub username: Option<String>,
pub name: Option<String>,
pub email: Option<String>,
pub email_verified: Option<bool>,
pub picture: Option<String>,
pub locale: Option<String>,
pub additional_data: HashMap<String, Value>,
}
Expand description
Standardized user profile across all providers.
Fields§
§id: Option<String>
Unique identifier from the provider
provider: Option<String>
Provider that authenticated this user
username: Option<String>
Username or login name
name: Option<String>
Display name
email: Option<String>
Email address
email_verified: Option<bool>
Whether email is verified
picture: Option<String>
Profile picture URL
locale: Option<String>
Locale/language preference
additional_data: HashMap<String, Value>
Provider-specific additional data
Implementations§
Source§impl UserProfile
impl UserProfile
Sourcepub fn with_provider(self, provider: impl Into<String>) -> Self
pub fn with_provider(self, provider: impl Into<String>) -> Self
Set provider
Sourcepub fn with_username(self, username: Option<impl Into<String>>) -> Self
pub fn with_username(self, username: Option<impl Into<String>>) -> Self
Set username
Sourcepub fn with_email(self, email: Option<impl Into<String>>) -> Self
pub fn with_email(self, email: Option<impl Into<String>>) -> Self
Set email
Sourcepub fn with_email_verified(self, verified: bool) -> Self
pub fn with_email_verified(self, verified: bool) -> Self
Set email verification status
Sourcepub fn with_picture(self, picture: Option<impl Into<String>>) -> Self
pub fn with_picture(self, picture: Option<impl Into<String>>) -> Self
Set profile picture URL
Sourcepub fn with_locale(self, locale: Option<impl Into<String>>) -> Self
pub fn with_locale(self, locale: Option<impl Into<String>>) -> Self
Set locale
Sourcepub fn with_additional_data(self, key: impl Into<String>, value: Value) -> Self
pub fn with_additional_data(self, key: impl Into<String>, value: Value) -> Self
Add additional provider-specific data
Sourcepub fn from_token_response(
token: &OAuthTokenResponse,
provider: &OAuthProvider,
) -> Option<Self>
pub fn from_token_response( token: &OAuthTokenResponse, provider: &OAuthProvider, ) -> Option<Self>
Create a new user profile from an OAuth token response
Sourcepub fn from_id_token(id_token: &str) -> Result<Self>
pub fn from_id_token(id_token: &str) -> Result<Self>
Extract a user profile from an ID token (JWT)
Sourcepub fn to_auth_token(&self, access_token: String) -> AuthToken
pub fn to_auth_token(&self, access_token: String) -> AuthToken
Create an AuthToken with this profile’s information
Sourcepub fn display_name(&self) -> Option<&str>
pub fn display_name(&self) -> Option<&str>
Get display name or fall back to username
Trait Implementations§
Source§impl Clone for UserProfile
impl Clone for UserProfile
Source§fn clone(&self) -> UserProfile
fn clone(&self) -> UserProfile
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 UserProfile
impl Debug for UserProfile
Source§impl<'r> Decode<'r, Postgres> for UserProfile
impl<'r> Decode<'r, Postgres> for UserProfile
Source§fn decode(value: PgValueRef<'r>) -> Result<Self, BoxDynError>
fn decode(value: PgValueRef<'r>) -> Result<Self, BoxDynError>
Decode a new value of this type using a raw value from the database.
Source§impl Default for UserProfile
impl Default for UserProfile
Source§impl<'de> Deserialize<'de> for UserProfile
impl<'de> Deserialize<'de> for UserProfile
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
Source§impl Serialize for UserProfile
impl Serialize for UserProfile
Source§impl Type<Postgres> for UserProfile
impl Type<Postgres> for UserProfile
Source§fn type_info() -> PgTypeInfo
fn type_info() -> PgTypeInfo
Returns the canonical SQL type for this Rust type. Read more
Source§fn compatible(ty: &PgTypeInfo) -> bool
fn compatible(ty: &PgTypeInfo) -> bool
Determines if this Rust type is compatible with the given SQL type. Read more
Auto Trait Implementations§
impl Freeze for UserProfile
impl RefUnwindSafe for UserProfile
impl Send for UserProfile
impl Sync for UserProfile
impl Unpin for UserProfile
impl UnwindSafe for UserProfile
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