Skip to main content

ResolvedOAuthConfig

Struct ResolvedOAuthConfig 

Source
#[non_exhaustive]
pub struct ResolvedOAuthConfig {
Show 20 fields pub issuer: String, pub jwks_uri: Option<String>, pub audience: String, pub audiences: Vec<String>, pub resource: String, pub required_scopes: Vec<String>, pub scopes_supported: Vec<String>, pub scope_claims: Vec<String>, pub principal_claims: Vec<String>, pub algorithms: Vec<Algorithm>, pub leeway_secs: u64, pub require_at_jwt: bool, pub allow_unscoped_tokens: bool, pub allow_insecure_http: bool, pub accept_static_bearer: bool, pub allowed_client_ids: Vec<String>, pub max_token_age_secs: Option<u64>, pub required_claims: BTreeMap<String, Value>, pub resource_name: Option<String>, pub key_naming: KeyNamingBuf,
}
Expand description

The validated config an crate::OAuthValidator is built from.

Only OAuthConfig::resolve produces one with every invariant checked, so holding a ResolvedOAuthConfig (rather than an Option of one) IS the answer to “is OAuth on and usable” — nothing downstream re-checks a boolean. Fields are public so tests and applications can adjust a resolved value (the validator re-checks the invariants whose violation it could not survive: a non-empty audience set, a non-empty algorithm list, and leeway_secs within MAX_LEEWAY_SECS).

#[non_exhaustive]: outside this crate one comes from OAuthConfig::resolve (or, in tests, testing::resolved_config) and is then adjusted field by field, never built with a struct literal — which is what lets a new resolved setting be added without a breaking change.

Debug is hand-written and masks a credential in issuer, jwks_uri and resource the way OAuthConfig’s does.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§issuer: String

See OAuthConfig::issuer; byte-exact.

§jwks_uri: Option<String>

None means “discover from the issuer’s metadata”. Never blank.

§audience: String

The single audience; may be empty when audiences is not. Use ResolvedOAuthConfig::accepted_audiences for the effective set.

§audiences: Vec<String>§resource: String§required_scopes: Vec<String>

required_scope ∪ required_scopes: trimmed, deduplicated, in config order (required_scope first). A token must carry every one; empty means no scope check at all.

§scopes_supported: Vec<String>

See OAuthConfig::scopes_supported; None there resolves to required_scopes. Advertised in the metadata document (omitted from it when empty) and in the 401 challenge.

§scope_claims: Vec<String>§principal_claims: Vec<String>§algorithms: Vec<Algorithm>

Parsed and deduplicated. Algorithm has no HMAC or none variant, so this can never hold one.

§leeway_secs: u64§require_at_jwt: bool§allow_unscoped_tokens: bool

See OAuthConfig::allow_unscoped_tokens. Informational once resolved: resolve has already applied it.

§allow_insecure_http: bool

See OAuthConfig::allow_insecure_http. resolve has already applied it to the configured URLs; the validator still reads it, for a discovered jwks_uri and for redirects followed while fetching keys.

§accept_static_bearer: bool§allowed_client_ids: Vec<String>

See OAuthConfig::allowed_client_ids; empty means no client check.

§max_token_age_secs: Option<u64>

See OAuthConfig::max_token_age_secs; None means no age check.

§required_claims: BTreeMap<String, Value>

See OAuthConfig::required_claims; empty means no claim check.

§resource_name: Option<String>

Human-readable name published as resource_name in the RFC 9728 metadata document; omitted from it when None. Not a config key: OAuthConfig::resolve leaves it None, and an application that wants one sets it on the resolved value (it names the application, which the operator has no reason to change).

§key_naming: KeyNamingBuf

How the validator’s log lines and errors name settings; what resolve was given.

Implementations§

Source§

impl ResolvedOAuthConfig

Source

pub fn accepted_audiences(&self) -> Vec<String>

audience ∪ audiences, blanks dropped, in config order.

Trait Implementations§

Source§

impl Clone for ResolvedOAuthConfig

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 ResolvedOAuthConfig

Hand-written so a credential in a URL setting never reaches a log line through {:?}.

Source§

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

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

impl Eq for ResolvedOAuthConfig

Source§

impl PartialEq for ResolvedOAuthConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ResolvedOAuthConfig

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