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 new() -> SamlConfig
pub fn new() -> SamlConfig
Create a new SAML configuration with minimal required fields
Sourcepub fn entity_id(self, entity_id: impl Into<String>) -> SamlConfig
pub fn entity_id(self, entity_id: impl Into<String>) -> SamlConfig
Set the SP entity ID
Sourcepub fn idp_sso_url(self, url: impl Into<String>) -> SamlConfig
pub fn idp_sso_url(self, url: impl Into<String>) -> SamlConfig
Set the IdP SSO URL
Sourcepub fn idp_slo_url(self, url: impl Into<String>) -> SamlConfig
pub fn idp_slo_url(self, url: impl Into<String>) -> SamlConfig
Set the IdP SLO URL
Sourcepub fn idp_entity_id(self, entity_id: impl Into<String>) -> SamlConfig
pub fn idp_entity_id(self, entity_id: impl Into<String>) -> SamlConfig
Set the IdP entity ID
Sourcepub fn idp_certificate(self, cert: impl Into<String>) -> SamlConfig
pub fn idp_certificate(self, cert: impl Into<String>) -> SamlConfig
Set the IdP certificate (PEM format)
Sourcepub fn sp_private_key(self, key: impl Into<String>) -> SamlConfig
pub fn sp_private_key(self, key: impl Into<String>) -> SamlConfig
Set the SP private key (PEM format)
Sourcepub fn sp_certificate(self, cert: impl Into<String>) -> SamlConfig
pub fn sp_certificate(self, cert: impl Into<String>) -> SamlConfig
Set the SP certificate (PEM format)
Sourcepub fn acs_url(self, url: impl Into<String>) -> SamlConfig
pub fn acs_url(self, url: impl Into<String>) -> SamlConfig
Set the Assertion Consumer Service URL
Sourcepub fn assertion_consumer_service_url(
self,
url: impl Into<String>,
) -> SamlConfig
pub fn assertion_consumer_service_url( self, url: impl Into<String>, ) -> SamlConfig
Alias for acs_url
Sourcepub fn sls_url(self, url: impl Into<String>) -> SamlConfig
pub fn sls_url(self, url: impl Into<String>) -> SamlConfig
Set the Single Logout Service URL
Sourcepub fn sso_binding(self, binding: SamlBinding) -> SamlConfig
pub fn sso_binding(self, binding: SamlBinding) -> SamlConfig
Set the SSO binding
Sourcepub fn slo_binding(self, binding: SamlBinding) -> SamlConfig
pub fn slo_binding(self, binding: SamlBinding) -> SamlConfig
Set the SLO binding
Sourcepub fn name_id_format(self, format: NameIdFormat) -> SamlConfig
pub fn name_id_format(self, format: NameIdFormat) -> SamlConfig
Set the Name ID format
Sourcepub fn authn_context_class(self, class: AuthnContextClass) -> SamlConfig
pub fn authn_context_class(self, class: AuthnContextClass) -> SamlConfig
Set the authentication context class
Sourcepub fn sign_authn_request(self, sign: bool) -> SamlConfig
pub fn sign_authn_request(self, sign: bool) -> SamlConfig
Set whether to sign AuthnRequest
Sourcepub fn want_assertions_signed(self, signed: bool) -> SamlConfig
pub fn want_assertions_signed(self, signed: bool) -> SamlConfig
Set whether assertions must be signed
Sourcepub fn want_assertions_encrypted(self, encrypted: bool) -> SamlConfig
pub fn want_assertions_encrypted(self, encrypted: bool) -> SamlConfig
Set whether assertions must be encrypted
Sourcepub fn max_clock_skew(self, skew: Duration) -> SamlConfig
pub fn max_clock_skew(self, skew: Duration) -> SamlConfig
Set maximum clock skew tolerance
Sourcepub fn map_attribute(
self,
saml_attribute: impl Into<String>,
user_field: impl Into<String>,
) -> SamlConfig
pub fn map_attribute( self, saml_attribute: impl Into<String>, user_field: impl Into<String>, ) -> SamlConfig
Add an attribute mapping
Sourcepub fn role_attribute(self, attr: impl Into<String>) -> SamlConfig
pub fn role_attribute(self, attr: impl Into<String>) -> SamlConfig
Set the role attribute name
Set the authority attribute name
Sourcepub fn default_roles(self, roles: Vec<String>) -> SamlConfig
pub fn default_roles(self, roles: Vec<String>) -> SamlConfig
Set default roles for authenticated users
Sourcepub fn allow_unsolicited_responses(self, allow: bool) -> SamlConfig
pub fn allow_unsolicited_responses(self, allow: bool) -> SamlConfig
Set whether to allow unsolicited responses
Sourcepub fn session_timeout(self, timeout: Duration) -> SamlConfig
pub fn session_timeout(self, timeout: Duration) -> SamlConfig
Set session timeout
Sourcepub fn okta(
okta_domain: impl Into<String>,
app_id: impl Into<String>,
sp_entity_id: impl Into<String>,
) -> SamlConfig
pub fn okta( okta_domain: impl Into<String>, app_id: impl Into<String>, sp_entity_id: impl Into<String>, ) -> SamlConfig
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>,
) -> SamlConfig
pub fn azure_ad( tenant_id: impl Into<String>, _app_id: impl Into<String>, sp_entity_id: impl Into<String>, ) -> SamlConfig
Create configuration preset for Azure AD
Sourcepub fn google_workspace(
sp_entity_id: impl Into<String>,
acs_url: impl Into<String>,
) -> SamlConfig
pub fn google_workspace( sp_entity_id: impl Into<String>, acs_url: impl Into<String>, ) -> SamlConfig
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
Source§impl Default for SamlConfig
impl Default for SamlConfig
Source§fn default() -> SamlConfig
fn default() -> 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