SAML 2.0
OkYouIn is a SAML 2.0 identity provider (IdP) for applications that expect one. SAML applications share the sign-in page and the session with OpenID Connect: a user signed in to GitLab over OIDC opens Nextcloud over SAML without a second prompt.
Step-by-step setups: GitLab, Nextcloud, FortiGate admin GUI. Templates for Microsoft 365, Google Workspace, Palo Alto GlobalProtect and any SAML service provider exist but are not verified in our lab yet.
Requirements
Section titled “Requirements”- The server’s public URL (Settings ▸ General) must be
https://. It is part of every IdP URL; without it every/saml/endpoint answers503. - The service provider (SP) must receive the response on an
httpsACS URL (httponly forlocalhost,127.0.0.1and[::1]).
IdP URLs of an application
Section titled “IdP URLs of an application”Every SAML application gets a SAML slug, generated from its name when it is created and
fixed afterwards. It is part of the IdP entity ID and of every URL the SP uses. For an
application with the slug nextcloud on https://mfa.example.com:
| What | URL |
|---|---|
| IdP entity ID (Issuer) | https://mfa.example.com/saml/nextcloud |
| Metadata | https://mfa.example.com/saml/nextcloud/metadata |
| Single sign-on service (Redirect and POST) | https://mfa.example.com/saml/nextcloud/sso |
| Single logout service (Redirect and POST) | https://mfa.example.com/saml/nextcloud/slo |
| Signing certificate | https://mfa.example.com/saml/nextcloud/certificate.pem |
| Next certificate (during a rotation) | https://mfa.example.com/saml/nextcloud/certificate.pem?which=next |
| IdP-initiated start | https://mfa.example.com/saml/nextcloud/start |
The Connect tab shows the same values for your server, a Download metadata button and the certificate. Give the SP the metadata, or the URLs and the certificate.
What is supported
Section titled “What is supported”| Sign-in | SP-initiated: AuthnRequest over HTTP-Redirect or HTTP-POST; the Response always over HTTP-POST |
| IdP-initiated | Optional, per application (off by default) |
| Signing | Response, assertion or both; RSA or ECDSA with SHA-256 (never SHA-1) |
| Signed requests | Verified when the SP signs them; can be required |
| Single logout | SP-initiated, HTTP-Redirect or HTTP-POST |
| SP metadata | Imported from an XML file or pasted XML |
Not supported: the Artifact binding, encrypted assertions or NameIDs, SOAP or back-channel logout, IdP-initiated or propagated logout, fetching metadata from a URL, and arbitrary directory attributes or value transformations as attribute sources.
Configuring the service provider side
Section titled “Configuring the service provider side”The application’s Settings tab has four cards.
Service provider
Section titled “Service provider”| Setting | Meaning |
|---|---|
| SP Entity ID | The SP’s entity ID; every AuthnRequest must carry exactly this Issuer. |
| ACS endpoints | The SP’s Assertion Consumer Service URLs (HTTP-POST) with an index; one may be the default. A request naming an ACS URL must match one byte for byte. |
| SP single logout URL and Logout binding | Where the LogoutResponse goes (Redirect or POST). |
| SP certificates | The certificate(s) the SP signs requests with (PEM, at most two during a rollover). |
| Require signed requests | Refuse unsigned AuthnRequests. Needs at least one SP certificate. |
Import SP metadata fills this card from the SP’s metadata XML: entity ID, ACS endpoints, logout URL, certificates, whether it wants signed assertions, and its requested attributes (proposed as rows of the attribute table). Nothing is saved until you review the form and save. The metadata’s own signature is not checked.
Signing
Section titled “Signing”| Setting | Options |
|---|---|
| Sign | Response and assertion (default) · Assertion only · Response only |
| Signing certificate | Global certificate (recommended; shared by every SAML application on it) · Own certificate (this application’s own) |
Choose what the SP requires. Many SPs accept either level; some (Nextcloud, FortiGate with
require-signed-resp-and-asrt) want both.
NameID and attributes
Section titled “NameID and attributes”NameID format: E-mail address, Persistent, Unspecified or Transient. NameID value decides what goes into it:
| NameID value | Content |
|---|---|
| Opaque per-application ID | A stable ID per application and user that cannot be linked across applications (the default for Persistent). Re-creating the application produces new IDs. |
| Username | The OkYouIn username |
| Username with domain | username@domain for directory users |
The user’s e-mail; a user without one is refused (nameid_missing) | |
| OkYouIn user ID | The user’s UUID |
| objectGUID (base64, Microsoft ImmutableID) | For Microsoft 365 federation; directory users only |
A Transient NameID is new in every assertion.
The Attribute mapping table lists the SAML attributes the assertion carries, in order (at most 50):
| Column | Values |
|---|---|
| Name | The SAML attribute name |
| Name format | Unspecified, Basic or URI reference |
| Friendly name | Optional, meaningful with URI names |
| Value | A user field — E-mail, Username, Username with domain, First name, Last name, Display name, Phone, OkYouIn user ID, objectGUID (text or base64), MFA claim (Microsoft multipleauthn) — or Groups, or a Constant |
| Multi | For groups and constants: one AttributeValue per value; off joins groups with commas |
An attribute whose value is empty for a user is left out. Presets add common name sets: Microsoft claim URIs and OID (eduPerson).
Groups filter limits which groups are sent — one name per line, a name ending in *
matches as a prefix, case-insensitive; empty = all groups.
Preview for a user shows the NameID and attributes this application would send a chosen user now, from the form as it is (unsaved changes included). Nothing is signed, sent or logged — the quickest way to check a mapping before the SP sees it.
Application rules can add attributes on top of the table: a rule attribute with a row’s exact name replaces the row. Template attributes a rule leaves out are sent with their default.
General
Section titled “General”- IdP-initiated sign-in and Default RelayState — see below.
- Require MFA and Session lifetime (hours) — as for OIDC: how long one MFA serves this application.
SAML has no first-factor choice: the password is always checked by OkYouIn (or replaced by a Windows ticket).
The sign-in
Section titled “The sign-in”-
The SP sends an
AuthnRequestto/saml/<slug>/sso. OkYouIn checks the Issuer, the signature (when present or required), the destination and the ACS URL. A request that fails these checks never produces a POST to an unverified address — the user sees an error page instead. -
Without a live OkYouIn session the user signs in on the sign-in page: password, then the second factor if the rules require it.
-
OkYouIn posts the signed Response to the ACS URL. The assertion is valid for 5 minutes and names the SP as its audience.
-
A denied or cancelled sign-in posts an error Response back to the SP, so the SP can show its own message.
The policy is evaluated on every request with the browser’s address, exactly as for OIDC.
IdP-initiated sign-in
Section titled “IdP-initiated sign-in”With IdP-initiated sign-in on, opening https://mfa.example.com/saml/<slug>/start signs the
user in and posts an unsolicited Response to the SP, with Default RelayState as the
RelayState. It is off by default: unsolicited responses can be replayed at SPs that keep no
one-time cache, and any web page can make a browser sign in to the SP. Turn it on only for SPs
that need it. GitLab accepts it; Nextcloud’s user_saml and FortiGate refuse it.
Signing certificates and rotation
Section titled “Signing certificates and rotation”Certificates live in slots: one global slot (Access ▸ Settings ▸ Single sign-on) and one per application that uses its own certificate (on the application’s Settings tab). Each slot holds certificates in three states:
| State | Meaning |
|---|---|
| Active | Signs every Response and assertion. |
| Next | Prepared and already published in the metadata, but not signing yet. |
| Retired | Replaced; kept so that Revert can bring it back. |
The global certificate is created at the first start of OkYouIn. Generated certificates are self-signed RSA 3072, valid for 3 years. You can also Upload your own (PEM or PKCS#12) or create a CSR and upload the certificate your CA issues.
Rotating without an outage
Section titled “Rotating without an outage”-
Prepare next — Generate, Upload or CSR. The new certificate is stored as Next and published in the metadata at once; the active one keeps signing.
-
Give the next certificate to every SP that pins the certificate or its fingerprint (the Connect tab and
certificate.pem?which=nextserve it). SPs that read the metadata pick it up on their own. -
Activate next — the next certificate signs from now on and the active one becomes Retired.
-
If an SP breaks, Revert — the newest retired certificate signs again and the current one goes back to next.
Rotation is never automatic: SPs that pin a certificate (FortiGate, GitLab with a fingerprint) would break silently. Each device guide says how its SP handles a rotation — GitLab can trust two certificates at once; Nextcloud and FortiGate hold exactly one and need the switch right after Activate next. Putting such an application on its own certificate keeps a rotation of the global one away from it.
Switching an application between the global and its own certificate takes effect when you save: the SP must trust the new one, or sign-ins fail. To switch without an outage, keep the application on the global certificate, prepare its own next certificate, give it to the SP, then Activate next — the application switches to its own certificate in the same step.
Expiry alerts
Section titled “Expiry alerts”Every certificate in use raises an alert 60 days before it expires, escalated at 30 and 7 days, listing the affected applications and whether a next certificate is already prepared. An expired certificate keeps signing — most SPs ignore the validity of a pinned IdP certificate — so the alert is a warning, not an outage.
Single logout
Section titled “Single logout”When the SP sends a LogoutRequest to /saml/<slug>/slo, OkYouIn ends the OkYouIn session
and returns a LogoutResponse to the SP single logout URL. A signed request that matches
the browser’s session ends it at once; an unsigned one first shows the “Sign out?”
confirmation.
Troubleshooting
Section titled “Troubleshooting”Every SAML sign-in and sign-out is in Logging ▸ SSO sign-in log.
| Symptom | Look at |
|---|---|
| Error page instead of the sign-in | The Issuer differs from SP Entity ID, the ACS URL is not registered (byte for byte), or the request is unsigned while Require signed requests is on. |
| SP says the signature is invalid | The SP holds another certificate — after a rotation, or after switching between global and own. Compare fingerprints on the Connect tab. |
| SP refuses the Response as unsigned | Set Sign to Response and assertion. |
nameid_missing | The NameID value is E-mail (or objectGUID) and the user has none. |
| SP creates a new account for an existing user | The NameID changed — another NameID value, or a re-created application with an opaque NameID. |
| Groups missing | Groups filter, or the attribute is single-valued (Multi off). Check with Preview for a user. |