pub struct IssuerConfig {Show 19 fields
pub scheme: String,
pub host: String,
pub port: u16,
pub scopes_supported: HashSet<String>,
pub claims_supported: Vec<String>,
pub grant_types_supported: HashSet<String>,
pub response_types_supported: HashSet<String>,
pub token_endpoint_auth_methods_supported: HashSet<String>,
pub code_challenge_methods_supported: HashSet<String>,
pub subject_types_supported: Vec<String>,
pub id_token_signing_alg_values_supported: Vec<String>,
pub generate_client_secret_for_dcr: bool,
pub allowed_origins: Vec<String>,
pub default_user_id: String,
pub require_state: bool,
pub access_token_expires_in: u64,
pub refresh_token_expires_in: u64,
pub authorization_code_expires_in: u64,
pub cleanup_interval_secs: u64,
}Expand description
Server-level configuration for the OAuth2 / OIDC issuer.
Construct via IssuerConfig::default() and override individual fields,
or build one from scratch for full control.
Fields§
§scheme: String§host: String§port: u16§scopes_supported: HashSet<String>§claims_supported: Vec<String>§grant_types_supported: HashSet<String>§response_types_supported: HashSet<String>§token_endpoint_auth_methods_supported: HashSet<String>§code_challenge_methods_supported: HashSet<String>§subject_types_supported: Vec<String>§id_token_signing_alg_values_supported: Vec<String>§generate_client_secret_for_dcr: bool§allowed_origins: Vec<String>CORS origins to allow. If empty, all origins are allowed.
default_user_id: StringDefault sub claim value used when no user is logged in.
require_state: boolRequire state parameter in authorization requests (RFC 6749 compliance).
Default: true
access_token_expires_in: u64Access token expiration time in seconds. Default: 3600 (1 hour)
refresh_token_expires_in: u64Refresh token expiration time in seconds. Default: 86400 * 30 (30 days)
Authorization code expiration time in seconds. Default: 600 (10 minutes)
cleanup_interval_secs: u64Cleanup interval for expired tokens/codes in seconds. Default: 300 (5 minutes). Set to 0 to disable.
Implementations§
Source§impl IssuerConfig
impl IssuerConfig
Sourcepub fn from_env() -> Result<Self, Error>
pub fn from_env() -> Result<Self, Error>
Load configuration from environment variables, prefixed with OAUTH_.
Sourcepub fn to_discovery_document(&self, issuer: String) -> Value
pub fn to_discovery_document(&self, issuer: String) -> Value
Build the OpenID Connect Discovery document for this issuer.
Sourcepub fn validate_scope(&self, scope: &str) -> Result<String, String>
pub fn validate_scope(&self, scope: &str) -> Result<String, String>
Validates that all requested scopes are in scopes_supported.
Returns the original scope string on success, or an error message on failure.
Sourcepub fn validate_grant_type(&self, grant: &str) -> bool
pub fn validate_grant_type(&self, grant: &str) -> bool
Returns true if the given grant type is in grant_types_supported.
Sourcepub fn from_file(path: &Path) -> Result<Self, ConfigError>
pub fn from_file(path: &Path) -> Result<Self, ConfigError>
Sourcepub fn from_yaml(yaml: &str) -> Result<Self, ConfigError>
pub fn from_yaml(yaml: &str) -> Result<Self, ConfigError>
Load configuration from YAML string.
Sourcepub fn from_toml(toml_str: &str) -> Result<Self, ConfigError>
pub fn from_toml(toml_str: &str) -> Result<Self, ConfigError>
Load configuration from TOML string.
Trait Implementations§
Source§impl Clone for IssuerConfig
impl Clone for IssuerConfig
Source§fn clone(&self) -> IssuerConfig
fn clone(&self) -> IssuerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more