pub struct SamlConfig {Show 23 fields
pub entity_id: String,
pub idp_sso_url: String,
pub idp_slo_url: Option<String>,
pub idp_entity_id: Option<String>,
pub idp_certificate: Option<String>,
pub sp_private_key: Option<String>,
pub sp_certificate: Option<String>,
pub acs_url: String,
pub sls_url: Option<String>,
pub sso_binding: SamlBinding,
pub slo_binding: SamlBinding,
pub name_id_format: NameIdFormat,
pub authn_context_class: Option<AuthnContextClass>,
pub sign_authn_request: bool,
pub want_assertions_signed: bool,
pub want_assertions_encrypted: bool,
pub max_clock_skew: Duration,
pub attribute_mapping: HashMap<String, String>,
pub role_attribute: Option<String>,
pub authority_attribute: Option<String>,
pub default_roles: Vec<String>,
pub allow_unsolicited_responses: bool,
pub session_timeout: Duration,
}Expand description
SAML Service Provider configuration
Fields§
§entity_id: StringSP Entity ID (unique identifier)
idp_sso_url: StringIdP SSO URL (where to send AuthnRequest)
idp_slo_url: Option<String>IdP Single Logout URL (optional)
idp_entity_id: Option<String>IdP Entity ID
idp_certificate: Option<String>IdP certificate for signature verification (PEM format)
sp_private_key: Option<String>SP private key for signing requests (PEM format)
sp_certificate: Option<String>SP certificate (PEM format)
acs_url: StringAssertion Consumer Service URL
sls_url: Option<String>Single Logout Service URL
sso_binding: SamlBindingPreferred binding for SSO
slo_binding: SamlBindingPreferred binding for SLO
name_id_format: NameIdFormatName ID format to request
authn_context_class: Option<AuthnContextClass>Authentication context class to request
sign_authn_request: boolWhether to sign AuthnRequest
want_assertions_signed: boolWhether to require signed assertions
want_assertions_encrypted: boolWhether to require encrypted assertions
max_clock_skew: DurationMaximum allowed clock skew
attribute_mapping: HashMap<String, String>Attribute mapping (SAML attribute name -> User field)
role_attribute: Option<String>Role attribute name
Authority attribute name
default_roles: Vec<String>Default roles for authenticated users
allow_unsolicited_responses: boolAllow unsolicited responses (IdP-initiated SSO)
session_timeout: DurationSession timeout
Implementations§
Source§impl SamlConfig
impl SamlConfig
Sourcepub fn idp_sso_url(self, url: impl Into<String>) -> Self
pub fn idp_sso_url(self, url: impl Into<String>) -> Self
Set the IdP SSO URL
Sourcepub fn idp_slo_url(self, url: impl Into<String>) -> Self
pub fn idp_slo_url(self, url: impl Into<String>) -> Self
Set the IdP SLO URL
Sourcepub fn idp_entity_id(self, entity_id: impl Into<String>) -> Self
pub fn idp_entity_id(self, entity_id: impl Into<String>) -> Self
Set the IdP entity ID
Sourcepub fn idp_certificate(self, cert: impl Into<String>) -> Self
pub fn idp_certificate(self, cert: impl Into<String>) -> Self
Set the IdP certificate (PEM format)
Sourcepub fn sp_private_key(self, key: impl Into<String>) -> Self
pub fn sp_private_key(self, key: impl Into<String>) -> Self
Set the SP private key (PEM format)
Sourcepub fn sp_certificate(self, cert: impl Into<String>) -> Self
pub fn sp_certificate(self, cert: impl Into<String>) -> Self
Set the SP certificate (PEM format)
Sourcepub fn assertion_consumer_service_url(self, url: impl Into<String>) -> Self
pub fn assertion_consumer_service_url(self, url: impl Into<String>) -> Self
Alias for acs_url
Sourcepub fn sso_binding(self, binding: SamlBinding) -> Self
pub fn sso_binding(self, binding: SamlBinding) -> Self
Set the SSO binding
Sourcepub fn slo_binding(self, binding: SamlBinding) -> Self
pub fn slo_binding(self, binding: SamlBinding) -> Self
Set the SLO binding
Sourcepub fn name_id_format(self, format: NameIdFormat) -> Self
pub fn name_id_format(self, format: NameIdFormat) -> Self
Set the Name ID format
Sourcepub fn authn_context_class(self, class: AuthnContextClass) -> Self
pub fn authn_context_class(self, class: AuthnContextClass) -> Self
Set the authentication context class
Sourcepub fn sign_authn_request(self, sign: bool) -> Self
pub fn sign_authn_request(self, sign: bool) -> Self
Set whether to sign AuthnRequest
Sourcepub fn want_assertions_signed(self, signed: bool) -> Self
pub fn want_assertions_signed(self, signed: bool) -> Self
Set whether assertions must be signed
Sourcepub fn want_assertions_encrypted(self, encrypted: bool) -> Self
pub fn want_assertions_encrypted(self, encrypted: bool) -> Self
Set whether assertions must be encrypted
Sourcepub fn max_clock_skew(self, skew: Duration) -> Self
pub fn max_clock_skew(self, skew: Duration) -> Self
Set maximum clock skew tolerance
Sourcepub fn map_attribute(
self,
saml_attribute: impl Into<String>,
user_field: impl Into<String>,
) -> Self
pub fn map_attribute( self, saml_attribute: impl Into<String>, user_field: impl Into<String>, ) -> Self
Add an attribute mapping
Sourcepub fn role_attribute(self, attr: impl Into<String>) -> Self
pub fn role_attribute(self, attr: impl Into<String>) -> Self
Set the role attribute name
Set the authority attribute name
Sourcepub fn default_roles(self, roles: Vec<String>) -> Self
pub fn default_roles(self, roles: Vec<String>) -> Self
Set default roles for authenticated users
Sourcepub fn allow_unsolicited_responses(self, allow: bool) -> Self
pub fn allow_unsolicited_responses(self, allow: bool) -> Self
Set whether to allow unsolicited responses
Sourcepub fn session_timeout(self, timeout: Duration) -> Self
pub fn session_timeout(self, timeout: Duration) -> Self
Set session timeout
Sourcepub fn okta(
okta_domain: impl Into<String>,
app_id: impl Into<String>,
sp_entity_id: impl Into<String>,
) -> Self
pub fn okta( okta_domain: impl Into<String>, app_id: impl Into<String>, sp_entity_id: impl Into<String>, ) -> Self
Create configuration preset for Okta
Sourcepub fn azure_ad(
tenant_id: impl Into<String>,
_app_id: impl Into<String>,
sp_entity_id: impl Into<String>,
) -> Self
pub fn azure_ad( tenant_id: impl Into<String>, _app_id: impl Into<String>, sp_entity_id: impl Into<String>, ) -> Self
Create configuration preset for Azure AD
Sourcepub fn google_workspace(
sp_entity_id: impl Into<String>,
acs_url: impl Into<String>,
) -> Self
pub fn google_workspace( sp_entity_id: impl Into<String>, acs_url: impl Into<String>, ) -> Self
Create configuration preset for Google Workspace
Trait Implementations§
Source§impl Clone for SamlConfig
impl Clone for SamlConfig
Source§fn clone(&self) -> SamlConfig
fn clone(&self) -> SamlConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SamlConfig
impl Debug for SamlConfig
Auto Trait Implementations§
impl Freeze for SamlConfig
impl RefUnwindSafe for SamlConfig
impl Send for SamlConfig
impl Sync for SamlConfig
impl Unpin for SamlConfig
impl UnwindSafe for SamlConfig
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<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 more