ใ‚†ใ‚‹ใƒ†ใƒƒใ‚ฏใƒŽใƒผใƒˆ

Extended SAML Guide

This guide dives into more advanced SAML topics such as Single Logout (SLO), encrypted assertions, and metadata structure that are important for real-world implementation.

๐Ÿ” Single Logout (SAML SLO)

SAML SLO allows users to sign out of all connected services from either the IdP or SP, depending on how the flow is triggered.

SLO Flow

  • โžก๏ธ User clicks logout from SP or IdP.
  • โžก๏ธ A SAML LogoutRequest is sent to the other party.
  • โžก๏ธ The other party returns a LogoutResponse.
  • โžก๏ธ If multiple SPs are involved, LogoutRequests may cascade to each.

Implementation Considerations

  • โš ๏ธ Deleting session cookies alone may not complete logout.
  • โš ๏ธ Plan carefully which side (IdP or SP) initiates the SLO.
  • โš ๏ธ Not all IdPs support multi-SP logout flows.

๐Ÿ” Encrypted Assertion

Assertions can be encrypted to protect attribute values in transit between IdP and SP.

Why Encrypt?

  • โœ… Protects user attributes from being exposed during transit.
  • โœ… Helps prevent replay attacks or data leakage.
  • โœ… Useful in B2B integrations requiring privacy guarantees.

Requirements for Decryption

  • ๐Ÿ”‘ The SP must hold a private key to decrypt.
  • ๐Ÿ”‘ The IdP must have access to the SPโ€™s public key to encrypt.
  • ๐Ÿ”‘ Check if your SP library supports EncryptedAssertion.

๐Ÿ“„ Metadata Structure

SAML metadata is an XML file that defines information about IdPs and SPs, including certificates and endpoints.

Key Elements

  • ๐Ÿ“˜ EntityDescriptor: Top-level element representing the IdP or SP.
  • ๐Ÿ“˜ KeyDescriptor: Includes signing and encryption certificates.
  • ๐Ÿ“˜ SingleSignOnService: URL for IdP login requests.
  • ๐Ÿ“˜ AssertionConsumerService: Where the SP receives the SAMLResponse.

Best Practices

  • ๐Ÿ” Expired certificates can cause validation failures.
  • ๐Ÿ” Make sure endpoint URLs are correct (no typos, correct protocol).
  • ๐Ÿ” Custom metadata should follow SAML schemas strictly.