Sign in with SAML

  • For IT
  • Bugsoft Portal 4.12.14

Connect a sign-in system with SAML 2.0 (ADFS, Google Workspace, Okta, JumpCloud, PingFederate, Keycloak), change the certificate, and what does not work yet.

In short

  • Does your sign-in system also support OpenID Connect? That is usually easier: see Another sign-in system (OpenID Connect).
  • SAML needs the PHP extension php-xml on the server.
  • Give the sign-in system the Bugsoft Portal metadata, let it sign the assertion, and use a fixed ID for the person.
  • A certificate expires. Add the new one as the second certificate before the old one ends.

First: php-xml on the server

SAML needs the PHP extension dom. It is in the package php-xml. You only need it on a server that uses SAML. Without it, Bugsoft Portal does not offer SAML; everything else works as usual.

  • With install.sh: sudo ./install.sh --saml (also later, when you run it again).
  • By hand on Ubuntu and Debian: sudo apt install php8.3-xml (use the version number of your PHP). On Oracle Linux: sudo dnf install php-xml. Then restart PHP-FPM.

sudo bugsoft production:check reports an error when a SAML connection is on and the extension is missing.

Set it up

A SAML system "Klaverveld SAML" in Connections: at the top the card with the copy fields (Bugsoft Portal metadata, ACS address, entityID), below it the details with the certificate and its fingerprint
  1. In Admin › Settings › Sign-in › Connections, under Add another sign-in system, choose the protocol SAML 2.0 and a name for the button. Which system? is only for OpenID Connect: with SAML 2.0 it is hidden, and ignored if you see it. The system stays off for now.
  2. In the sign-in system, create a SAML application for Bugsoft Portal. The easiest way is to give it the Bugsoft Portal metadata. Its address is at the top of the page, for example https://portal.klaverveld.example/auth/saml/klaverveld/metadata.
  3. If that is not possible, enter two values by hand: the ACS address (…/auth/saml/klaverveld/acs, binding HTTP-POST) and the entityID (…/auth/saml/klaverveld).
  4. Let the system sign the assertion with RSA-SHA256. An assertion that is not signed is refused, even if the whole message is signed.
  5. Choose a fixed ID (persistent) as the NameID. Send the e-mail address, the name and the groups as attributes. A transient NameID changes at every sign-in; you can only use it when a fixed attribute is the person.
  6. On Connections, enter the details of the sign-in system: the entityID, the sign-in address (SSO, binding HTTP-Redirect) and the signing certificate. Or paste the system's metadata (or its https address) under Fill in with the metadata of the sign-in system. Bugsoft Portal then fills in these three values.
  7. Choose Save and test, switch the system on, and sign in once with an ordinary account.

If the person in Bugsoft Portal is an e-mail address (a NameID in e-mail format, or the e-mail attribute), Connections warns you. An address can change, or later be given to someone else, who then gets the account of the previous person. Rather choose a fixed ID.

Attributes and groups

Bugsoft Portal recognises the common names itself (such as mail, displayName, groups and the claim addresses of ADFS). You can change them under Attributes (advanced): one or more names per field, separated by commas.

  • The groups arrive in Bugsoft Portal as groups of this sign-in system. You can use them for tiles, audiences and roles. You change the members in the sign-in system, not in Bugsoft Portal.
  • Want to use a group before anyone from it has signed in? In Admin › Audiences › Groups, choose Add a group of the sign-in system, this system, and the value exactly as the groups attribute sends it.
  • If the system sends no groups attribute for someone, that person is in none of its groups.
  • The sign-in system checks e-mail addresses is on by default. Switch it off if the system passes on addresses it does not check itself. Note: with Only these e-mail domains, nobody can then sign in.

ADFS

  1. In AD FS Management, create a Relying Party Trust. Choose Import data about the relying party published online with the Bugsoft Portal metadata.
  2. Under Claim Issuance Policy, add a rule Send LDAP Attributes as Claims: E-Mail-Addresses → E-Mail Address, Display-Name → Name, Token-Groups – Unqualified Names → Group.
  3. Add a rule Transform an Incoming Claim that sends a fixed ID (for example the objectGUID) as Name ID in the format Persistent Identifier.

The ADFS metadata is at https://adfs.klaverveld.example/FederationMetadata/2007-06/FederationMetadata.xml.

Google Workspace

  1. In the Admin console, go to Apps › Web and mobile apps › Add app › Add custom SAML app.
  2. Download the IdP metadata and paste it on Connections.
  3. For the service provider, enter the ACS address and the entityID of Bugsoft Portal. As the Name ID format, choose PERSISTENT with Basic Information › Primary email.
  4. Under Attribute mapping, add mail. Under Group membership, add the groups with the app attribute name groups. Google then only sends the groups you choose there.
  5. Switch the app on for the right organisational units.

Note: Google uses the e-mail address as the fixed ID here. If someone's address changes, Bugsoft Portal sees a different account.

Okta

  1. Under Applications › Create App Integration, create a SAML 2.0 app.
  2. Enter the ACS address under Single sign-on URL, and the entityID of Bugsoft Portal under Audience URI. Choose Name ID format Persistent.
  3. Add Attribute Statements (mail → user.email, displayName) and a Group Attribute Statement groups.
  4. Okta offers the IdP metadata as an address. Enter that address on Connections.

JumpCloud

  1. Under SSO Applications, create a Custom SAML App.
  2. Enter the entityID of Bugsoft Portal as SP Entity ID and the ACS address as ACS URL. Choose Sign Assertion.
  3. Add the attributes mail and displayName. Switch on Include group attribute with the name groups.
  4. Export the metadata and paste it on Connections.

PingFederate

  1. Create an SP Connection by importing the Bugsoft Portal metadata.
  2. Choose the profile Browser SSO with SP-initiated SSO, the binding POST for the assertion, and Sign Assertion.
  3. Send the e-mail address, the name and the groups as attributes, and a fixed ID as persistent NameID.

The PingFederate metadata is at https://ping.klaverveld.example/pf/federation_metadata.ping?PartnerSpId=….

Keycloak

  1. Create a client of the type SAML. Use the entityID of Bugsoft Portal as Client ID, and the ACS address as Valid redirect URIs.
  2. Under Keys and Signature and Encryption, switch on Sign assertions (Sign documents may stay on too), and switch off Encrypt assertions.
  3. Add mappers for mail, displayName and a Group list named groups (with Full group path off).

The metadata is at https://login.klaverveld.example/realms/kantoor/protocol/saml/descriptor.

Change the certificate

Bugsoft Portal only trusts the certificates on Connections, never a certificate that comes with a message. A certificate has an end date. It is in the list on Connections, and administrators get an e-mail 60, 30, 14, 7 and 1 days before.

After that date Bugsoft Portal no longer trusts the certificate. If there is no new certificate by then, nobody can sign in with the system. To change it without interruption:

  1. Create a new certificate in the sign-in system, but do not sign with it yet.
  2. On Connections, put the new certificate under Second certificate and choose Save and test. From now on, sign-in works with both.
  3. Let the sign-in system sign with the new certificate.
  4. Remove the old certificate on Connections.

What does not work yet

  • Sign-in that starts in the sign-in system (IdP-initiated, for example from a tile in the portal of the sign-in system) is refused. Start at Bugsoft Portal. If you like, add a bookmark in the sign-in system to https://portal.klaverveld.example/auth/login.
  • Encrypted assertions are refused with a clear message. Switch off encryption for Bugsoft Portal; the traffic already goes over https.
  • Signing out of the sign-in system (single logout) is not possible. Sign out only signs out of Bugsoft Portal. On a shared computer, close the browser afterwards.

If the session at the sign-in system ends earlier (SessionNotOnOrAfter), the session in Bugsoft Portal ends at that moment too.

It does not work?

  • The sign-in has expired or is not valid yet: the clocks of the server and the sign-in system differ by more than three minutes. Switch on NTP (automatic time) on the server.
  • This sign-in has expired or was already used: signing in took longer than ten minutes, started in another window, or the same message was sent twice. Try again from the sign-in page.
  • Every refused sign-in is in Admin › Identities › Sign-ins, with the reason. For example: signature (wrong certificate, or not signed), audience (wrong entityID), destination/recipient (wrong ACS address) or name_id_format (the system sends another NameID format than the one set).

More: Sign-in problems.

Stuck? See Questions and problems or contact Bugsoft at ugurs156@gmail.com.