This documentation is available to agents as Markdown at https://docs.synthesized.io/tdk/latest/user_guide/060_security_compliance/authentication/sso.md. For the complete documentation index, see llms.txt.

Single Sign-On

Governor supports single sign-on with OAuth2 (Google, Microsoft, GitHub and PingFederate) and with SAML (Microsoft Entra ID and Google). With SAML, Governor can also take users' roles from their groups in the identity provider.

Before you start

  • Serve Governor over HTTPS. Governor must be served over HTTPS from any address other than localhost, and single sign-on depends on it. The redirect and reply URLs you register with the identity provider must be the HTTPS address that users open, not the container’s internal port. See Setting up TLS termination for Docker Compose, or set up TLS on the ingress of the Helm chart.

  • Plan your administrators. Unless roles come from SAML groups, every SAML user, the first one included, gets GOVERNOR_SECURITY_DEFAULTROLE (MEMBER by default). The administrator is the account Governor creates at startup from ADMIN_EMAIL and ADMIN_DEFAULT_PASSWORD: sign in with it, while password sign-in is still on, to give SAML users other roles. Governor creates this account whether or not roles come from SAML groups. With roles from SAML groups, also map at least one group to ADMINISTRATOR, so administrators can sign in through SAML. See SAML Group-to-Role Mapping.

  • Know where the settings go. The settings on this page are Spring properties of Governor’s API. On Docker Compose, and anywhere the API is set up through its environment, set them as environment variables on the backend service. To turn a property name into an environment variable, write it in upper case, replace dots with underscores, and remove hyphens. For example, governor.security.saml.authorities.require-mapped-authority becomes GOVERNOR_SECURITY_SAML_AUTHORITIES_REQUIREMAPPEDAUTHORITY. For SAML on Helm, see SAML.

OAuth2

Register Governor as an OAuth2 application with your provider, then give Governor the client properties below. Setting a provider’s client-id adds its button to the sign-in page. For the full list of properties, see the Spring Boot reference.

  • Google

  • Microsoft

  • GitHub

  • PingFederate

spring.security.oauth2.client.registration.google.client-id=[client ID]
spring.security.oauth2.client.registration.google.client-secret=[client secret]
spring.security.oauth2.client.registration.microsoft.client-id=[client ID]
spring.security.oauth2.client.registration.microsoft.client-secret=[client secret]
spring.security.oauth2.client.registration.github.client-id=[client ID]
spring.security.oauth2.client.registration.github.client-secret=[client secret]
spring.security.oauth2.client.registration.github.redirect-uri=[redirect URI registered with GitHub]
spring.security.oauth2.client.registration.pingfederate.client-id=governor-client
spring.security.oauth2.client.registration.pingfederate.client-secret=your-client-secret
spring.security.oauth2.client.registration.pingfederate.redirect-uri=https://your-governor-host/oauth2/PINGFEDERATE
spring.security.oauth2.client.registration.pingfederate.client-authentication-method=client_secret_jwt
spring.security.oauth2.client.registration.pingfederate.authorization-grant-type=authorization_code
spring.security.oauth2.client.provider.pingfederate.authorization-uri=https://pingfederate.server/as/authorization.oauth2
spring.security.oauth2.client.provider.pingfederate.token-uri=https://pingfederate.server/as/token.oauth2
spring.security.oauth2.client.provider.pingfederate.user-info-endpoint-uri=https://pingfederate.server/idp/userinfo.openid
spring.security.oauth2.client.provider.pingfederate.jwks-set-uri=https://pingfederate.server/pf/JWKS

OAuth2 users' roles are managed in Governor: new users get the role in GOVERNOR_SECURITY_DEFAULTROLE (MEMBER by default), and administrators change it.

SAML

Each SAML identity provider has a registration ID: microsoft for Microsoft Entra ID, or google for Google.

1. Register Governor with your identity provider

Create a SAML application for Governor in your identity provider, with these URLs, where [host] is the HTTPS address users open Governor on:

Setting Value

Identifier (Entity ID)

https://[host]/api/v1/saml2/service-provider-metadata/[registration ID]

Reply URL (Assertion Consumer Service URL)

https://[host]/api/v1/saml2/login/sso/[registration ID]

The identity provider gives you its metadata: a URL, or an XML file to download.

2. Give Governor the identity provider’s metadata

Set the registration’s properties. {baseUrl} and {registrationId} are filled in by Governor: keep them as they are.

  • Microsoft Entra ID

  • Google

spring.security.saml2.relyingparty.registration.microsoft.entity-id={baseUrl}/api/v1/saml2/service-provider-metadata/{registrationId}
spring.security.saml2.relyingparty.registration.microsoft.acs.location={baseUrl}/api/v1/saml2/login/sso/{registrationId}
spring.security.saml2.relyingparty.registration.microsoft.assertingparty.metadata-uri=file:/IDP_metadata.xml
spring.security.saml2.relyingparty.registration.google.entity-id={baseUrl}/api/v1/saml2/service-provider-metadata/{registrationId}
spring.security.saml2.relyingparty.registration.google.acs.location={baseUrl}/api/v1/saml2/login/sso/{registrationId}
spring.security.saml2.relyingparty.registration.google.assertingparty.metadata-uri=file:/IDP_metadata.xml

metadata-uri can be the metadata URL, or a file you mount into the container, such as file:/etc/governor/saml/idp-metadata.xml. With a file, Governor doesn’t need to reach the identity provider: the browser carries the sign-in, and Governor checks it against the certificate in the file. Use a file for offline installations, and replace it when the identity provider’s certificate changes.

On Docker Compose, set the same properties as environment variables on the backend service. This example sets up Microsoft Entra ID from its federation metadata URL, maps two directory groups to roles, and turns away anyone outside them:

services:
  backend:
    environment:
      # Identity provider registration
      - SPRING_SECURITY_SAML2_RELYINGPARTY_REGISTRATION_MICROSOFT_ENTITYID={baseUrl}/api/v1/saml2/service-provider-metadata/{registrationId}
      - SPRING_SECURITY_SAML2_RELYINGPARTY_REGISTRATION_MICROSOFT_ACS_LOCATION={baseUrl}/api/v1/saml2/login/sso/{registrationId}
      - SPRING_SECURITY_SAML2_RELYINGPARTY_REGISTRATION_MICROSOFT_ASSERTINGPARTY_METADATAURI=https://login.microsoftonline.com/<tenant-id>/federationmetadata/2007-06/federationmetadata.xml?appid=<application-id>
      - GOVERNOR_SECURITY_SAML_DEFAULTREGISTRATIONID=microsoft
      # Group-to-role mapping
      - GOVERNOR_SECURITY_SAML_AUTHORITIES_ENABLED=true
      - GOVERNOR_SECURITY_SAML_AUTHORITIES_GROUPATTRIBUTE=http://schemas.microsoft.com/ws/2008/06/identity/claims/groups
      - GOVERNOR_SECURITY_SAML_AUTHORITIES_REQUIREMAPPEDAUTHORITY=true
      - GOVERNOR_SECURITY_SAML_AUTHORITIES_ALIASES_0_GROUP=<directory group for administrators>
      - GOVERNOR_SECURITY_SAML_AUTHORITIES_ALIASES_0_ROLE=ADMINISTRATOR
      - GOVERNOR_SECURITY_SAML_AUTHORITIES_ALIASES_1_GROUP=<directory group for members>
      - GOVERNOR_SECURITY_SAML_AUTHORITIES_ALIASES_1_ROLE=MEMBER

On Kubernetes, the same settings go in the Helm values under api.saml. The group mapping is api.saml.governor.authorities, and its aliases list becomes the numbered environment variables above.

Restart the API container after a change.

Microsoft Entra ID, step by step

  1. In the Entra admin center, create an Enterprise Application for Governor, and choose SAML as its single sign-on method.

  2. Set the Identifier (Entity ID) to https://[host]/api/v1/saml2/service-provider-metadata/microsoft and the Reply URL to https://[host]/api/v1/saml2/login/sso/microsoft.

  3. Copy the App Federation Metadata Url and use it as the metadata URI, or download the federation metadata XML and mount it as a file.

  4. Under Single sign-on > Attributes & Claims, add a group claim, so that the SAML assertion carries the user’s groups. Entra sends the group’s object ID by default. To match on group names instead, set the claim to send the display name.

  5. Set GOVERNOR_SECURITY_SAML_AUTHORITIES_GROUPATTRIBUTE to the name of the claim Entra sends. Unless you change it, it’s http://schemas.microsoft.com/ws/2008/06/identity/claims/groups.

  6. For each Governor role, add an alias whose group matches exactly what the claim sends: the object ID or the display name.

  7. Assign the directory groups to the Enterprise Application, and restart the backend service.

  8. Sign in with an account that maps to ADMINISTRATOR, and check its role, before you turn off password sign-in.

SAML Group-to-Role Mapping

Governor can set each SAML user’s global role from their groups in the identity provider, in the same way as LDAP authorities.

Roles managed in Governor (default)

By default, roles are managed in Governor. Every SAML user gets the role in GOVERNOR_SECURITY_DEFAULTROLE (MEMBER by default), whoever signs in first. To give users other roles, sign in with the administrator account Governor creates from ADMIN_EMAIL.

Roles from SAML groups

Turn on role mapping, and say where the groups are and which role to give users whose groups match nothing:

governor.security.saml.authorities.enabled=true
governor.security.saml.authorities.group-attribute=groups (1)
governor.security.saml.authorities.convert-to-uppercase=true (2)
governor.security.saml.authorities.default-role=MEMBER (3)
1 The SAML attribute that lists the user’s groups. Default: groups.
2 Converts group names to upper case before they’re matched. Default: true.
3 The role for a user whose groups match no alias. Default: MEMBER.

Then map group names to roles with aliases:

governor.security.saml.authorities.role-aliases.tdk-admins=ADMINISTRATOR
governor.security.saml.authorities.role-aliases.developers=MEMBER

The role-aliases map can’t be set with environment variables. On Docker Compose, and anywhere the API is set up through its environment, use the numbered list instead:

GOVERNOR_SECURITY_SAML_AUTHORITIES_ALIASES_0_GROUP=tdk-admins
GOVERNOR_SECURITY_SAML_AUTHORITIES_ALIASES_0_ROLE=ADMINISTRATOR
GOVERNOR_SECURITY_SAML_AUTHORITIES_ALIASES_1_GROUP=developers
GOVERNOR_SECURITY_SAML_AUTHORITIES_ALIASES_1_ROLE=MEMBER

You can use both forms together: they’re merged at startup. Group names are matched case-insensitively unless convert-to-uppercase is false.

  • A user in several mapped groups gets the highest role: ADMINISTRATOR before MEMBER.

  • OWNER is an older name for ADMINISTRATOR. Settings and role mappings that still use it keep working and give the Administrator role.

  • Roles are updated at each sign-in from the user’s current groups, and role management in the web UI becomes read-only.

Admitting only members of mapped groups

By default, a user whose groups match no alias still signs in, with default-role. To turn away anyone outside a mapped group:

governor.security.saml.authorities.require-mapped-authority=true

With this setting, default-role is ignored, and an unmapped user is refused at sign-in. Use it in production: it adds a check in Governor on top of the identity provider’s own assignment. If it’s on while no aliases are set, every SAML user is refused, and the API log shows a warning at startup.

SAML Logout

By default, signing out ends the Governor session and returns the user to the sign-in page. The user stays signed in to the identity provider.

With Single Logout (SLO), Governor sends a SAML logout request to the identity provider, which signs the user out of both:

governor.security.saml.slo-enabled=true (1)
governor.security.saml.default-registration-id=microsoft (2)
1 Turns on Single Logout. Default: false.
2 The registration used for logout. Required when Single Logout is on.

Auto-redirect to single sign-on

When only one identity provider is set up, Governor can skip the sign-in page’s provider buttons and send users straight to the provider. It’s off by default. Turn it on with:

GOVERNOR_SECURITY_SSOAUTOREDIRECTENABLED=true

With several providers, the buttons are always shown. While password sign-in is on, the email and password form is still reachable at /login-by-password, so an administrator can sign in without the identity provider.

Making SSO the only way to sign in

Once single sign-on works, you can remove the email and password form:

governor.security.password-login-enabled=false

The environment variable is GOVERNOR_SECURITY_PASSWORDLOGINENABLED=false.

To avoid locking you out, Governor removes the form only when at least one OAuth2 or SAML provider has loaded and LDAP isn’t set up. If no provider is available, for example because the SAML registration failed to load, Governor keeps the form and logs a warning at startup. LDAP uses the same form, so with LDAP, password sign-in stays on.

Check single sign-on end to end with an account that maps to ADMINISTRATOR before you turn password sign-in off.

Check that it works

  1. Open Governor in a private browser window, and sign in with the identity provider’s button.

  2. Under Administration, check that the user has the role you expect.

  3. With group mapping, sign in as a user in each mapped group, and as a user in no mapped group.

  4. Keep an administrator who can sign in another way until you’ve checked all three.