pub struct OAuthResourceServerConfig {
pub remote: OAuthProviderRemoteConfig,
pub audiences: Vec<String>,
pub required_scopes: Vec<String>,
pub clock_skew: Duration,
pub introspection: Option<OAuthResourceServerIntrospectionConfig>,
}Fields§
§remote: OAuthProviderRemoteConfigShared remote-provider connectivity settings.
audiences: Vec<String>Accepted aud values. Empty means audience validation is disabled.
required_scopes: Vec<String>Required scopes. Empty means no scope requirement is enforced.
clock_skew: DurationAllowed clock skew when validating exp and nbf.
introspection: Option<OAuthResourceServerIntrospectionConfig>Optional opaque-token introspection configuration.
Example TOML:
[oauth_resource_server]
well_known_url = "https://issuer.example.com/.well-known/openid-configuration"
audiences = ["api://securitydept"]
required_scopes = ["entries.read", "entries.write"]
[oauth_resource_server.introspection]
client_id = "resource-server"
client_secret = "secret"
token_type_hint = "access_token"
# optional override:
# introspection_url = "https://issuer.example.com/oauth2/introspect"Implementations§
Source§impl OAuthResourceServerConfig
impl OAuthResourceServerConfig
pub fn validate(&self) -> Result<(), OAuthResourceServerError>
Apply shared defaults from an [oidc] block in-place.
Resolution order for supported fields:
well_known_url,issuer_url,jwks_uri— local > shared > Noneintrospection.client_id,introspection.client_secret— local > shared > None (only whenintrospectionis alreadySome)required_scopes— local non-empty wins; else inherited from shared
Duration fields are resolved with sentinel heuristics; see
OidcSharedConfig for the known limitation.
Sourcepub fn resolve_config(
&mut self,
shared: &OidcSharedConfig,
) -> Result<(), OAuthResourceServerError>
pub fn resolve_config( &mut self, shared: &OidcSharedConfig, ) -> Result<(), OAuthResourceServerError>
Recommended entry point. Apply shared defaults and validate in one step.
Equivalent to self.apply_shared_defaults(shared); self.validate()
but eliminates manual glue.
[oidc] ──┐
├──▸ resolve_config() ──▸ validated &mut self
[oauth_resource_server] ──┘pub fn provider_config(&self) -> OAuthProviderConfig
Trait Implementations§
Source§impl Clone for OAuthResourceServerConfig
impl Clone for OAuthResourceServerConfig
Source§fn clone(&self) -> OAuthResourceServerConfig
fn clone(&self) -> OAuthResourceServerConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OAuthResourceServerConfig
impl Debug for OAuthResourceServerConfig
Source§impl Default for OAuthResourceServerConfig
impl Default for OAuthResourceServerConfig
Source§fn default() -> OAuthResourceServerConfig
fn default() -> OAuthResourceServerConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for OAuthResourceServerConfig
impl<'de> Deserialize<'de> for OAuthResourceServerConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<OAuthResourceServerConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<OAuthResourceServerConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for OAuthResourceServerConfig
impl RefUnwindSafe for OAuthResourceServerConfig
impl Send for OAuthResourceServerConfig
impl Sync for OAuthResourceServerConfig
impl Unpin for OAuthResourceServerConfig
impl UnsafeUnpin for OAuthResourceServerConfig
impl UnwindSafe for OAuthResourceServerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more