Skip to main content

GenericOAuthConfig

Struct GenericOAuthConfig 

Source
pub struct GenericOAuthConfig {
Show 35 fields pub client_id: String, pub client_secret: Option<String>, pub discovery_url: Option<String>, pub discovery_headers: HeaderMap, pub require_id_token_verification: bool, pub authorization_url: Option<String>, pub token_url: Option<String>, pub user_info_url: Option<String>, pub end_session_endpoint: Option<String>, pub post_logout_redirect_uri: Option<String>, pub disable_provider_logout: bool, pub token_endpoint_auth: Option<TokenEndpointAuth>, pub authentication: Option<TokenEndpointSecretAuthentication>, pub scopes: Vec<String>, pub redirect_uri: Option<String>, pub response_type: Option<String>, pub response_mode: Option<String>, pub prompt: Option<String>, pub pkce: bool, pub access_type: Option<String>, pub access_token_expires_in: Option<f64>, pub authorization_url_params: IndexMap<String, String>, pub token_url_params: HashMap<String, String>, pub authorization_headers: HeaderMap, pub refresh_token_params: Option<RefreshTokenParameters>, pub get_token: Option<Arc<dyn OAuthTokenHandler>>, pub get_user_info: Option<Arc<dyn GenericOAuthUserInfoHandler>>, pub map_profile_to_user: Option<Arc<dyn OAuthProfileMapper>>, pub account_subject: Option<Arc<dyn OAuthAccountSubject>>, pub disable_implicit_sign_up: bool, pub disable_sign_up: bool, pub override_user_info: bool, pub require_email_verification: bool, pub allow_idp_initiated: bool, pub disable_id_token_nonce_binding: bool,
}
Expand description

Generic OAuth and OpenID Connect provider configuration.

Discovery resolves once when the auth instance is built. Set require_id_token_verification for providers whose identity comes from ID tokens.

Fields§

§client_id: String

OAuth client identifier.

§client_secret: Option<String>

Client secret; omit for public clients or private-key JWT authentication.

§discovery_url: Option<String>

OpenID configuration URL.

§discovery_headers: HeaderMap

Headers included in the discovery request.

§require_id_token_verification: bool

Require discovery to supply a usable issuer and JWKS URI.

§authorization_url: Option<String>

Explicit authorization endpoint; overrides discovery.

§token_url: Option<String>

Explicit token endpoint; overrides discovery.

§user_info_url: Option<String>

Explicit userinfo endpoint; overrides discovery.

§end_session_endpoint: Option<String>

Explicit RP-initiated logout endpoint; overrides discovery.

§post_logout_redirect_uri: Option<String>

Default redirect after provider logout.

§disable_provider_logout: bool

Complete only local logout even when the provider supports logout.

§token_endpoint_auth: Option<TokenEndpointAuth>

Client authentication for code exchange and token refresh.

§authentication: Option<TokenEndpointSecretAuthentication>

Upstream’s legacy secret authentication selection.

§scopes: Vec<String>

Default scopes; OIDC discovery providers also request openid.

§redirect_uri: Option<String>

Override the generated callback URI.

§response_type: Option<String>

Authorization response type; defaults to code.

§response_mode: Option<String>

Authorization response mode, such as query or form_post.

§prompt: Option<String>

Provider authentication prompt.

§pkce: bool

Send PKCE challenges and verifiers; defaults to true.

§access_type: Option<String>

Authorization access type, such as offline.

§access_token_expires_in: Option<f64>

Fallback access-token lifetime when the token response omits an expiry.

§authorization_url_params: IndexMap<String, String>

Extra authorization parameters in insertion order; reserved fields are protected.

§token_url_params: HashMap<String, String>

Extra code-exchange parameters that cannot replace standard grant fields.

§authorization_headers: HeaderMap

Additional headers for authorization-code exchange.

§refresh_token_params: Option<RefreshTokenParameters>

Extra token refresh parameters.

§get_token: Option<Arc<dyn OAuthTokenHandler>>

Custom code exchange for providers with a nonstandard token endpoint.

§get_user_info: Option<Arc<dyn GenericOAuthUserInfoHandler>>

Custom raw-profile lookup.

§map_profile_to_user: Option<Arc<dyn OAuthProfileMapper>>

Map profile fields independently of account recognition.

§account_subject: Option<Arc<dyn OAuthAccountSubject>>

Override the immutable subject resolver (sub for OIDC, id for OAuth).

§disable_implicit_sign_up: bool

Require an explicit requestSignUp to create a new user.

§disable_sign_up: bool

Reject creation of new users through this provider.

§override_user_info: bool

Update existing local profile fields on sign-in.

§require_email_verification: bool

Require the local user’s email to be verified before issuing a session.

§allow_idp_initiated: bool

Restart callbacks without state using a fresh authorization request.

§disable_id_token_nonce_binding: bool

Disable the default OIDC nonce binding for providers that cannot echo a nonce.

Implementations§

Source§

impl GenericOAuthConfig

Source

pub fn auth0( client_id: &str, client_secret: &str, domain: &str, ) -> AuthResult<Self>

Configure Auth0 discovery from a domain or URL and the default OIDC scopes.

Source

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

Configure Keycloak discovery from the realm issuer and default OIDC scopes.

Source

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

Configure Okta discovery from the issuer and default OIDC scopes.

Source§

impl GenericOAuthConfig

Source

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

Configure Gumroad with its view_profile scope and user profile endpoint.

Source

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

Configure HubSpot with its oauth scope and access-token profile lookup.

Source

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

Configure Patreon with its identity[email] scope and identity fields.

Source

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

Configure Slack with its OpenID scopes and userinfo profile mapping.

Source

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

Configure Yandex with its info, email, and avatar scopes.

Source§

impl GenericOAuthConfig

Source

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

Configure LINE code login with profile claims from its ID-token verification endpoint. Register each channel with its own name through OAuthPlugin::add_generic_provider.

Source§

impl GenericOAuthConfig

Source

pub fn microsoft_entra_id( client_id: &str, client_secret: &str, tenant_id: &str, ) -> AuthResult<Self>

Configure Microsoft Entra ID for one concrete tenant GUID with verified ID tokens.

Trait Implementations§

Source§

impl Clone for GenericOAuthConfig

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 Default for GenericOAuthConfig

Source§

fn default() -> Self

Returns the “default value” for a type. 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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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