Single Sign-On in SAP Commerce

Single Sign-On (SSO) shares login authentication across multiple applications. It allows users to sign into one system and access multiple associated systems without having to sign into these again.

Security Assertion Markup Language (SAML) 2.0 is an XML-based protocol that uses security tokens containing assertions to pass information about a principal (usually an end user) between an identity provider, and a SAML consumer, that is, a service provider. SAML 2.0 enables web-based authentication and authorization scenarios including cross-domain SSO. The samlsinglesignon extension uses the Spring Security library and the SAML 2.0 protocol to authenticate and authorize data across different security domains.

SSO authenticates users for all applications they have been authorised to use and eliminates the need to log in when they switch applications during a particular session. SSO reduces the administrative overhead of distributing multiple authentication tokens to users.

In a typical SSO flow, users have to establish an identity with the identity provider. Then, when they attempt to access the desired application, the identity provider sends a SAML assertion to the service provider, verifying their identity and privileges. The service provider accepts the assertion and users gain access to the application.

Request Flow

When a user tries to access an SAP Commerce storefront, the request flow looks as follows:

  1. Instead of going to the storefront directly, the user's request goes to the samlsinglesignon extension.

  2. The samlsinglesignon extension listens for incoming requests and verifies if the user has a SAML assertion. If the user doesn't have a SAML assertion, the extension redirects the user to the identity provider and they're asked to log in.

  3. After making sure the user is logged in and a SAML assertion exists for this particular user, the extension creates a secure cookie with the user's details and redirects them to the storefront. You can inject your custom logic for user after authentication.

  4. The storefront consumes the cookie and takes any further actions required.