Skip to main content

OAuthProvider

Struct OAuthProvider 

Source
pub struct OAuthProvider {
Show 23 fields pub client_id: String, pub additional_client_ids: Vec<String>, pub hosted_domain: Option<String>, pub require_email_verification: bool, pub client_secret: String, pub auth_url: String, pub token_url: String, pub user_info_url: Option<String>, pub scopes: Vec<String>, pub authorization: Option<OAuthAuthorizationPolicy>, pub authorization_params: Vec<(String, String)>, pub allowed_request_params: Vec<String>, pub account_subject: Option<OAuthAccountSubject>, pub map_user_info: Option<fn(Value) -> Result<OAuthUserInfo, String>>, pub get_user_info: Option<Arc<dyn OAuthUserInfoHandler>>, pub refresh_access_token: Option<Arc<dyn OAuthRefreshTokenHandler>>, pub verify_id_token: Option<Arc<dyn OAuthIdTokenVerifier>>, pub id_token: Option<OAuthIdTokenConfig>, pub disable_id_token_sign_in: bool, pub disable_implicit_sign_up: bool, pub disable_sign_up: bool, pub allow_idp_initiated: bool, pub override_user_info_on_sign_in: bool,
}
Expand description

Configuration for a single OAuth provider.

Fields§

§client_id: String§additional_client_ids: Vec<String>

Additional Google client IDs accepted when verifying ID tokens.

§hosted_domain: Option<String>

Google Workspace domain restriction, independently of authorization parameters.

§require_email_verification: bool

Require a verified provider email before creating the authentication session.

§client_secret: String§auth_url: String§token_url: String§user_info_url: Option<String>§scopes: Vec<String>§authorization: Option<OAuthAuthorizationPolicy>

Built-in authorization behavior. None preserves custom-provider behavior. scopes remains the provider’s base scope list; this policy adds configured and request scopes in the provider’s published order.

§authorization_params: Vec<(String, String)>§allowed_request_params: Vec<String>

Query parameter names accepted from per-request authorizationParams. Empty by default. Unlisted names and reserved OAuth parameters are ignored. Allowed values override authorization_params and additionalParams, but provider policy’s fixed_authorization_params take precedence.

§account_subject: Option<OAuthAccountSubject>

Selects the factory account subject from the original provider profile.

§map_user_info: Option<fn(Value) -> Result<OAuthUserInfo, String>>§get_user_info: Option<Arc<dyn OAuthUserInfoHandler>>§refresh_access_token: Option<Arc<dyn OAuthRefreshTokenHandler>>§verify_id_token: Option<Arc<dyn OAuthIdTokenVerifier>>

Application override takes precedence over the trusted built-in JWKS policy.

§id_token: Option<OAuthIdTokenConfig>§disable_id_token_sign_in: bool

Disable the complete ID-token branch, including an application verifier override.

§disable_implicit_sign_up: bool§disable_sign_up: bool§allow_idp_initiated: bool

Start a new state-bound authorization flow for a callback without state.

§override_user_info_on_sign_in: bool

Implementations§

Source§

impl OAuthProvider

Source

pub fn discord(client_id: &str, client_secret: &str) -> Self

Source§

impl OAuthProvider

Source

pub fn github(client_id: &str, client_secret: &str) -> Self

Source

pub fn github_with_endpoints( client_id: &str, client_secret: &str, auth_url: &str, token_url: &str, user_info_url: &str, user_emails_url: &str, ) -> Self

Construct a GitHub provider using custom endpoints.

This keeps the built-in GitHub semantics while allowing local test harnesses or GitHub Enterprise-style deployments to override the URLs.

Source§

impl OAuthProvider

Source

pub fn gitlab(client_id: &str, client_secret: &str) -> Self

GitLab.com social login with the published read_user scope and PKCE.

Source

pub fn gitlab_with_issuer( client_id: &str, client_secret: &str, issuer: &str, ) -> Self

GitLab social login hosted at an application-configured issuer.

The issuer may include a deployment path. Repeated path slashes follow the pinned provider’s endpoint construction rather than URL resolution.

Source§

impl OAuthProvider

Source

pub fn with_hosted_domain(self, domain: impl Into<String>) -> Self

Source

pub fn google(client_id: &str, client_secret: &str) -> Self

Source§

impl OAuthProvider

Source

pub fn roblox(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn roblox_with_options(options: RobloxOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn salesforce(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn salesforce_with_options(options: SalesforceOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn slack(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn slack_with_options(options: SlackOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn spotify(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn spotify_with_options(options: SpotifyOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn tiktok(client_key: &str, client_secret: &str) -> Self

Source

pub fn tiktok_with_options(options: TikTokOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn twitch(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn twitch_with_options(options: TwitchOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn twitter(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn twitter_with_options(options: TwitterOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn vercel(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn vercel_with_options(options: VercelOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn vk(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn vk_with_options(options: VkOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn wechat(client_id: &str, client_secret: &str) -> Self

Source

pub fn wechat_with_options(options: WeChatOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn zoom(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn zoom_with_options(options: ZoomOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn reddit(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn reddit_with_options(options: RedditOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn railway(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn railway_with_options(options: RailwayOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn paypal(client_id: &str, client_secret: &str) -> Self

Source

pub fn paypal_with_options(options: PayPalOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn paybin(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn paybin_with_options(options: PaybinOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn polar(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn polar_with_options(options: PolarOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn notion(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn notion_with_options(options: NotionOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn cloudflare(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn cloudflare_with_options(options: CloudflareOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn cognito(options: CognitoOptions) -> Result<Self, String>

Builds the published Cognito provider from application-owned configuration.

§Errors

Returns an error if the domain, region or user pool is empty.

Source§

impl OAuthProvider

Source

pub fn dropbox(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn dropbox_with_options(options: DropboxOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn figma(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn figma_with_options(options: FigmaOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn facebook(client_id: &str, client_secret: &str) -> Self

Source

pub fn facebook_with_options(options: FacebookOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn atlassian(client_id: &str, client_secret: &str) -> Self

Source

pub fn atlassian_with_options(options: AtlassianOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn apple(client_id: &str, client_secret: &str) -> Self

Source

pub fn apple_with_options(options: AppleOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn microsoft(options: MicrosoftOptions) -> Result<Self, String>

Builds Microsoft’s actual authorization, grant and tenant-verification policy.

§Errors

Returns an error when a secret is combined with a client assertion.

Source§

impl OAuthProvider

Source

pub fn huggingface(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn huggingface_with_options(options: HuggingFaceOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn kakao(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn kakao_with_options(options: KakaoOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn kick(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn kick_with_options(options: KickOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn line(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn line_with_options(options: LineOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn naver(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn naver_with_options(options: NaverOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn linkedin(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn linkedin_with_options(options: LinkedInOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn linear(client_id: &str, client_secret: Option<&str>) -> Self

Source

pub fn linear_with_options(options: LinearOptions) -> Self

Source§

impl OAuthProvider

Source

pub fn with_profile_mapper(self, mapper: Arc<dyn OAuthProfileMapper>) -> Self

Install asynchronous partial mapping on the dedicated factory’s profile handler. Installing a custom userinfo handler afterwards replaces both the default transport and mapping, matching getUserInfo precedence.

Source

pub fn with_client_ids(self, client_ids: Vec<String>) -> Self

Source

pub const fn require_email_verification(self, required: bool) -> Self

Trait Implementations§

Source§

impl Clone for OAuthProvider

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OAuthProvider

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more