pub struct OAuthConfigBuilder { /* private fields */ }Expand description
Builder for OAuthConfig.
Obtain via OAuthConfig::builder. All setters consume self and
return a new builder, so they compose fluently. Call
OAuthConfigBuilder::build to produce the final OAuthConfig.
Implementations§
Source§impl OAuthConfigBuilder
impl OAuthConfigBuilder
Sourcepub fn scopes(self, scopes: Vec<ScopeMapping>) -> Self
pub fn scopes(self, scopes: Vec<ScopeMapping>) -> Self
Replace the scope-to-role mappings.
Sourcepub fn scope(self, scope: impl Into<String>, role: impl Into<String>) -> Self
pub fn scope(self, scope: impl Into<String>, role: impl Into<String>) -> Self
Append a single scope-to-role mapping.
Sourcepub fn role_claim(self, claim: impl Into<String>) -> Self
pub fn role_claim(self, claim: impl Into<String>) -> Self
Set the JWT claim path used to extract roles directly (without
going through scope mappings).
Sourcepub fn role_mappings(self, mappings: Vec<RoleMapping>) -> Self
pub fn role_mappings(self, mappings: Vec<RoleMapping>) -> Self
Replace the claim-value-to-role mappings.
Sourcepub fn role_mapping(
self,
claim_value: impl Into<String>,
role: impl Into<String>,
) -> Self
pub fn role_mapping( self, claim_value: impl Into<String>, role: impl Into<String>, ) -> Self
Append a single claim-value-to-role mapping (used with
Self::role_claim).
Sourcepub fn jwks_cache_ttl(self, ttl: impl Into<String>) -> Self
pub fn jwks_cache_ttl(self, ttl: impl Into<String>) -> Self
Override the JWKS cache TTL (humantime string, e.g. "5m").
Defaults to "10m".
Sourcepub fn proxy(self, proxy: OAuthProxyConfig) -> Self
pub fn proxy(self, proxy: OAuthProxyConfig) -> Self
Attach an OAuth proxy configuration. When set, the server
exposes /authorize, /token, and /register endpoints.
Sourcepub fn token_exchange(self, token_exchange: TokenExchangeConfig) -> Self
pub fn token_exchange(self, token_exchange: TokenExchangeConfig) -> Self
Attach an RFC 8693 token exchange configuration.
Sourcepub fn ca_cert_path(self, path: impl Into<PathBuf>) -> Self
pub fn ca_cert_path(self, path: impl Into<PathBuf>) -> Self
Provide a PEM CA bundle path used for all OAuth-bound HTTPS traffic
originated by this crate (JWKS fetches and the optional OAuth proxy
/authorize, /token, /register, /introspect, /revoke,
/.well-known/oauth-authorization-server upstream calls).
Sourcepub const fn allow_http_oauth_urls(self, allow: bool) -> Self
pub const fn allow_http_oauth_urls(self, allow: bool) -> Self
Allow plain-HTTP (non-TLS) URLs for OAuth endpoints.
Default: false. See the field-level documentation on
OAuthConfig::allow_http_oauth_urls for the security caveats
before enabling this.
Sourcepub const fn strict_audience_validation(self, strict: bool) -> Self
pub const fn strict_audience_validation(self, strict: bool) -> Self
Toggle strict audience validation so only the JWT aud claim is
considered and the compatibility fallback to azp is disabled.
Sourcepub const fn jwks_max_response_bytes(self, bytes: u64) -> Self
pub const fn jwks_max_response_bytes(self, bytes: u64) -> Self
Override the maximum JWKS response body size in bytes.
Sourcepub fn build(self) -> OAuthConfig
pub fn build(self) -> OAuthConfig
Finalise the builder and return the OAuthConfig.
Trait Implementations§
Source§impl Clone for OAuthConfigBuilder
impl Clone for OAuthConfigBuilder
Source§fn clone(&self) -> OAuthConfigBuilder
fn clone(&self) -> OAuthConfigBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more