Skip to main content

Module saml

Module saml 

Source
Expand description

SAML 2.0 Authentication Module

Provides SAML 2.0 Single Sign-On (SSO) authentication support. This module implements the Service Provider (SP) side of SAML authentication.

§Features

  • SAML AuthnRequest Generation: Create authentication requests to IdP
  • SAML Response Validation: Parse and validate IdP responses
  • Assertion Processing: Extract user information from SAML assertions
  • Signature Verification: Verify XML signatures (with appropriate crypto)
  • Metadata Support: Configure from IdP/SP metadata

§Example

use actix_security::http::security::saml::{SamlConfig, SamlAuthenticator};

let config = SamlConfig::new()
    .entity_id("https://myapp.example.com/saml/metadata")
    .idp_sso_url("https://idp.example.com/saml/sso")
    .idp_certificate(include_str!("../idp-cert.pem"))
    .sp_private_key(include_str!("../sp-key.pem"))
    .assertion_consumer_service_url("https://myapp.example.com/saml/acs");

let authenticator = SamlAuthenticator::new(config);

§SAML Flow

  1. User accesses protected resource
  2. SP generates AuthnRequest and redirects to IdP
  3. User authenticates at IdP
  4. IdP sends SAML Response back to SP’s ACS URL
  5. SP validates response and creates session

Structs§

AuthnRequest
SAML AuthnRequest
SamlAssertion
SAML Assertion
SamlAuthResult
Result of successful SAML authentication
SamlAuthenticator
SAML Authenticator for actix-web
SamlConfig
SAML Service Provider configuration
SamlResponse
SAML Response

Enums§

AuthnContextClass
SAML 2.0 authentication context classes
NameIdFormat
SAML 2.0 name ID formats
SamlBinding
SAML 2.0 binding types
SamlError
SAML authentication error
SamlStatusCode
SAML Status codes