SAML 2.0

Security Assertion Markup Language (SAML) is an XML based way to implement single sign-on (SSO).

A cryptographically signed XML document (known as a “SAML Assertion”) is sent to the API gateway server (Gate) with your identifying information, such as username and group membership.

Gate verifies the XML document’s signature using a metadata file, and if successful, it associates the identifying information with the user and allows the user to proceed as authenticated.

Identity Provider Setup

  1. In your SAML Identity Provider (IdP), download the metadata.xml file. Some providers expose this as a URL. It may look something like this:

     <?xml version="1.0" encoding="UTF-8" standalone="no"?>
         <md:KeyDescriptor use="signing">
           <ds:KeyInfo xmlns:ds="">
  2. Create a Spinnaker SAML application.
  3. Specify the login URL as https://localhost:8084/saml/SSO. Replace “localhost” with Gate’s address, if known.
  4. Specify a unique entity ID (we’ll use io.spinnaker:test in our example).
  5. Enable the users you’d like to have access to your Spinnaker instance.

TODO: Add halyard commands here when halyard supports SAML

  1. Generate a keystore and key in a new Java Keystore with some password:
    keytool -genkey -v -keystore saml.jks -alias saml -keyalg RSA -keysize 2048 -validity 10000
  2. Create or modify your gate-local.yml file to include the following settings:
  enabled: true
  metadataUrl: file:/opt/spinnaker/config/metadata.xml
  keyStore: file:/opt/spinnaker/config/saml.jks
  keyStorePassword: hunter2
  keyStoreAliasName: saml
  issuerId: io.spinnaker:test
  redirectHostname: localhost:8084

Network Architecture and SSL Termination

During the SAML workflow, Gate makes an intelligent guess on how to assemble a URI to itself, called the Assertion Consumer Service URL. Sometimes this guess is wrong when Spinnaker is deployed in concert with other networking components, such as an SSL-terminating load balancer, or in the case of the Quickstart images, a fronting Apache instance.

To override the values to assemble the URL, use the following hal command:

hal config security authn saml edit --service-address-url

For the Quickstart images, append /gate to the `–service-address-url. All other configurations can omit this setting.


The SAML workflow below reflects the process when the user navigates to Spinnaker first, is redirected to the SAML IdP for login, and redirected back to Spinnaker. Some SAML providers will allow the user login to the SAML provider first, and click a link to be taken to Spinnaker.

sequenceDiagram participant Deck participant Gate participant IdentityProvider Deck->>+Gate: GET /something/protected Gate->>-Deck: HTTP 302 to https://idp.url/?SAMLRequest=... Deck->>+IdentityProvider: GET https://idp.url/?SAMLRequest=... IdentityProvider->>-Deck: Returns login page
  1. User attempts to access a protected resource.

  2. Gate redirects to the SAML provider, passing a few query params:
    • SAMLRequest: a Gzip’ed XML authentication request.
    • SigAlg: The algorithm used to generate the Signature parameter.
    • Signature: A digest of the SAMLRequest using the SigAlg algorithm and the server’s key.

    Within the SAMLRequest is the Assertion Consumer Service URL, with is the URL to your Gate instance. See here for how to override this value.

  3. SAML provider prompts user for username & password.
    sequenceDiagram participant Deck participant Gate participant IdentityProvider Deck->>+IdentityProvider: User sends credentials IdentityProvider->>-Deck: HTTP 200 with self-submitting form to POST https://gate.url Deck->>+Gate: POST /saml/SSO with { SAMLResponse: ... } Note right of Gate: User identity verified Note right of Gate: Gate extracts data based on userInfoMapping Gate->>-Deck: HTTP 302 /something/protected
  4. A SAML response must be POSTed to /saml/SSO, and most browsers won’t re-POST when given an HTTP 302. Instead, providers sometimes return a page (with HTTP 200) that has a self-submitting HTML form to POST to Gate’s /saml/SSO endpoint.

  5. Gate verifies the message’s integrity by checking its signature, and thus verifying the user’s identity information.

  6. Gate determines the username and/or email address, and optionally extracts group membership (if sent by the IdP).

  7. With the user’s identity verified, Gate redirects the user to the originally requested URL.

Next Steps

Now that you’ve authenticated the user, proceed to setting up their authorization.