#[non_exhaustive]pub struct Config {
pub client_id: String,
pub issuer_url: String,
pub metadata_source: MetadataSource,
pub end_session_url: Option<String>,
pub after_logout_url: Option<String>,
pub post_logout_redirect_name: Option<String>,
pub additional_trusted_audiences: Vec<String>,
pub require_issuer_match: bool,
}
Expand description
OpenID Connect client configuration
§Non-exhaustive
This struct is #[non_exhaustive]
, so it is not possible to directly create a struct, creating a new struct
is done using the Config::new
function. Additional properties are set using the with_*
functions.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.client_id: String
The client ID
issuer_url: String
The OpenID connect issuer URL.
metadata_source: MetadataSource
How to fetch the metadata
end_session_url: Option<String>
An override for the end session URL.
after_logout_url: Option<String>
The URL to navigate to after the logout has been completed.
post_logout_redirect_name: Option<String>
The name of the query parameter for the post logout redirect.
The defaults to post_logout_redirect_uri
for OpenID RP initiated logout.
However, e.g. older Keycloak instances, require this to be redirect_uri
.
additional_trusted_audiences: Vec<String>
Additional audiences of the ID token which are considered trustworthy.
Those audiences are allowed in addition to the client ID.
require_issuer_match: bool
Specifies whether the issuer claim must match the expected issuer URL for the provider.
Implementations§
Source§impl Config
impl Config
Sourcepub fn new(client_id: impl Into<String>, issuer_url: impl Into<String>) -> Self
pub fn new(client_id: impl Into<String>, issuer_url: impl Into<String>) -> Self
Create a new configuration
Sourcepub fn with_end_session_url(self, end_session_url: impl Into<String>) -> Self
pub fn with_end_session_url(self, end_session_url: impl Into<String>) -> Self
Set an override for the URL for ending the session.
Sourcepub fn with_after_logout_url(self, after_logout_url: impl Into<String>) -> Self
pub fn with_after_logout_url(self, after_logout_url: impl Into<String>) -> Self
Set the URL the issuer should redirect to after the logout
Sourcepub fn with_post_logout_redirect_name(
self,
post_logout_redirect_name: impl Into<String>,
) -> Self
pub fn with_post_logout_redirect_name( self, post_logout_redirect_name: impl Into<String>, ) -> Self
Set the name of the post logout redirect query parameter
Sourcepub fn with_additional_trusted_audiences(
self,
additional_trusted_audiences: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_additional_trusted_audiences( self, additional_trusted_audiences: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Set the additionally trusted audiences
Sourcepub fn extend_additional_trusted_audiences(
self,
additional_trusted_audiences: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn extend_additional_trusted_audiences( self, additional_trusted_audiences: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Extend the additionally trusted audiences.
Sourcepub fn add_additional_trusted_audience(
self,
additional_trusted_audience: impl Into<String>,
) -> Self
pub fn add_additional_trusted_audience( self, additional_trusted_audience: impl Into<String>, ) -> Self
Add an additionally trusted audience.
Sourcepub fn with_require_issuer_match(self, require_issuer_match: bool) -> Self
pub fn with_require_issuer_match(self, require_issuer_match: bool) -> Self
Specifies whether the issuer claim must match the expected issuer URL for the provider.
Sourcepub fn with_metadata_source(self, metadata_source: MetadataSource) -> Self
pub fn with_metadata_source(self, metadata_source: MetadataSource) -> Self
Set the metadata source
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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>
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>
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 moreSource§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self
to a value of a Properties
struct.