Skip to main content

IssuerConfig

Struct IssuerConfig 

Source
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: String

Default sub claim value used when no user is logged in.

§require_state: bool

Require state parameter in authorization requests (RFC 6749 compliance). Default: true

§access_token_expires_in: u64

Access token expiration time in seconds. Default: 3600 (1 hour)

§refresh_token_expires_in: u64

Refresh token expiration time in seconds. Default: 86400 * 30 (30 days)

§authorization_code_expires_in: u64

Authorization code expiration time in seconds. Default: 600 (10 minutes)

§cleanup_interval_secs: u64

Cleanup interval for expired tokens/codes in seconds. Default: 300 (5 minutes). Set to 0 to disable.

Implementations§

Source§

impl IssuerConfig

Source

pub fn from_env() -> Result<Self, Error>

Load configuration from environment variables, prefixed with OAUTH_.

Source

pub fn to_discovery_document(&self, issuer: String) -> Value

Build the OpenID Connect Discovery document for this issuer.

Source

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.

Source

pub fn validate_grant_type(&self, grant: &str) -> bool

Returns true if the given grant type is in grant_types_supported.

Source

pub fn from_file(path: &Path) -> Result<Self, ConfigError>

Load configuration from a file (YAML or TOML). The format is detected from the file extension.

§Example
let config = IssuerConfig::from_file("config.yaml").unwrap();
let config = IssuerConfig::from_file("config.toml").unwrap();
Source

pub fn from_yaml(yaml: &str) -> Result<Self, ConfigError>

Load configuration from YAML string.

Source

pub fn from_toml(toml_str: &str) -> Result<Self, ConfigError>

Load configuration from TOML string.

Trait Implementations§

Source§

impl Clone for IssuerConfig

Source§

fn clone(&self) -> IssuerConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for IssuerConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for IssuerConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for IssuerConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for IssuerConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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<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> 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<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: 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: 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,