pub struct FederatedProfile {
pub provider: String,
pub provider_id: String,
pub email: Option<String>,
pub email_verified: bool,
pub name: Option<String>,
pub attributes: Map<String, Value>,
}Expand description
A normalised profile from an external identity provider, ready to feed
IdentityService::login_federated.
Build it from your OAuth2Provider’s user-info and the provider’s
verified-email signal (never assume verified), or from a
VerifiedIdToken via FederatedProfile::from_id_token.
Fields§
§provider: String§provider_id: StringThe provider’s stable unique id for this account (Google sub, GitHub
numeric id, …). Primary linking key — never the email.
email: Option<String>§email_verified: boolWhether the provider asserts the email is verified. Gate all email-based linking on this.
name: Option<String>§attributes: Map<String, Value>Extra claims to carry onto the identity’s attributes (e.g. IdP groups).
Implementations§
Source§impl FederatedProfile
impl FederatedProfile
Sourcepub fn from_oauth(
provider: impl Into<String>,
provider_id: impl Into<String>,
email: Option<String>,
email_verified: bool,
) -> Self
pub fn from_oauth( provider: impl Into<String>, provider_id: impl Into<String>, email: Option<String>, email_verified: bool, ) -> Self
Build from the framework’s OAuth2 user-info. email_verified must be
supplied explicitly — the OAuth2 user-info type carries no such signal,
and defaulting it to true is exactly the takeover bug.
Sourcepub fn from_id_token(provider: impl Into<String>, tok: &VerifiedIdToken) -> Self
pub fn from_id_token(provider: impl Into<String>, tok: &VerifiedIdToken) -> Self
Build from a verified inbound OIDC id_token. email_verified is taken
from the token’s email_verified claim.
Trait Implementations§
Source§impl Clone for FederatedProfile
impl Clone for FederatedProfile
Source§fn clone(&self) -> FederatedProfile
fn clone(&self) -> FederatedProfile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for FederatedProfile
impl RefUnwindSafe for FederatedProfile
impl Send for FederatedProfile
impl Sync for FederatedProfile
impl Unpin for FederatedProfile
impl UnsafeUnpin for FederatedProfile
impl UnwindSafe for FederatedProfile
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request