SAML 2.0 SSO Guide
Overview
Section titled “Overview”Rakomi acts as a SAML 2.0 Service Provider (SP). Your enterprise IdP (Okta, Azure AD, Google Workspace, OneLogin) authenticates users and sends signed SAML Assertions to Rakomi’s ACS endpoint. Rakomi validates the assertion, provisions the user via JIT (Just-in-Time) if needed, and creates a Rakomi session.
End-User Browser │ │ 1. GET /saml/init/:connectionId ▼ Rakomi (SP) │ 2. Signs AuthnRequest → 302 redirect ▼ Enterprise IdP (Okta / Azure AD / etc.) │ 3. User authenticates │ 4. POST /saml/acs (SAMLResponse + RelayState) ▼ Rakomi (SP) │ 5. Validates signature, audience, replay protection │ 6. JIT-provisions user if new │ 7. Creates session → 302 to dashboard ▼ End-User Browser (authenticated)SP Endpoints
Section titled “SP Endpoints”| Endpoint | Purpose |
|---|---|
GET /saml/metadata | SP metadata XML — give this URL to IdP admin |
GET /saml/init/:connectionId | Initiates SP-initiated SSO flow |
POST /saml/acs | Assertion Consumer Service — receives SAML Response from IdP |
SP Metadata
Section titled “SP Metadata”Every IdP requires your SP metadata to set up the trust relationship. Provide the IdP admin with:
- Metadata URL:
{SAML_SP_ENTITY_ID}/saml/metadata - ACS URL (from metadata): matches
SAML_ACS_URLin your Rakomi deployment config - Entity ID: matches
SAML_SP_ENTITY_IDin your Rakomi deployment config - NameID Format:
urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress(preferred)
The metadata URL is static and permanent — safe to whitelist in your IdP.
Okta Setup
Section titled “Okta Setup”-
In Okta Admin Console, go to Applications → Create App Integration → SAML 2.0.
-
General Settings: Enter your app name.
-
Configure SAML:
- Single sign-on URL (ACS URL): paste from SP metadata
- Audience URI (SP Entity ID): paste from SP metadata
- NameID format:
EmailAddress - Application username:
Email
-
Attribute Statements — add these mappings:
Name Value emailuser.emailgivenNameuser.firstNamesnuser.lastName -
Finish and download the IdP metadata XML. Use it to create a SAML connection in the Rakomi dashboard.
-
Enable Sign AuthnRequest if your Okta policy requires signed requests.
Azure AD (Entra ID) Setup
Section titled “Azure AD (Entra ID) Setup”-
In Entra ID, go to Enterprise Applications → New application → Create your own application.
-
Select Integrate any other application you don’t find in the gallery (Non-gallery).
-
Go to Single sign-on → SAML:
- Basic SAML Configuration:
- Identifier (Entity ID): paste from SP metadata
- Reply URL (ACS URL): paste from SP metadata
- Basic SAML Configuration:
-
Attributes & Claims — the following are sent by default:
Claim name Value http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddressuser.mailhttp://schemas.xmlsoap.org/ws/2005/05/identity/claims/givennameuser.givennamehttp://schemas.xmlsoap.org/ws/2005/05/identity/claims/surnameuser.surname -
Download the Certificate (Base64) and the App Federation Metadata URL.
-
Create a SAML connection in Rakomi using the IdP metadata URL or the downloaded certificate.
Attribute Mapping
Section titled “Attribute Mapping”Rakomi supports custom attribute mapping per connection. Default attribute names are tried in order:
| Field | Default attribute names tried |
|---|---|
email | email, mail, http://schemas.xmlsoap.org/.../emailaddress |
firstName | givenName, firstName, http://schemas.xmlsoap.org/.../givenname |
lastName | sn, surname, lastName, http://schemas.xmlsoap.org/.../surname |
groups | groups, memberOf, http://schemas.microsoft.com/.../groups |
Email is normalized to lowercase and trimmed. A missing email attribute causes a saml/missing_email 400 error.
IdP-Initiated SSO
Section titled “IdP-Initiated SSO”By default, IdP-initiated SSO (unsolicited SAML Response with no prior AuthnRequest) is disabled per OWASP recommendation. Enable it per connection via settings.idp_initiated_sso: true.
IdP Certificate Rotation
Section titled “IdP Certificate Rotation”To rotate the IdP signing certificate without downtime:
-
Add the new certificate to
idp_config.certificatesarray (keep the old one too). -
Verify the SAML flow works with the new certificate (ask IdP admin to sign with new key).
-
Remove the old certificate from
idp_config.certificates.
Rakomi validates the SAML Response against all certificates in the array — this allows zero-downtime rotation.
Email Trust
Section titled “Email Trust”| Setting | Behavior |
|---|---|
provider_verified (default) | Email from IdP is trusted as verified. Enables email-based account linking. |
never_trust | Email is used only for display. No cross-flow account linking by email. |
SHA-1 Legacy Support
Section titled “SHA-1 Legacy Support”RSA-SHA1 signatures are rejected by default (CVE-2025-54419 mitigation). Per-connection opt-in:
{ "settings": { "algorithm_policy": { "legacy_sha1": true } }}Encrypted Assertions (NIST SP 800-63C FAL2)
Section titled “Encrypted Assertions (NIST SP 800-63C FAL2)”Rakomi supports <EncryptedAssertion> using the SP private key (SAML_SP_PRIVATE_KEY). When your IdP is configured to encrypt assertions:
- AES-256-GCM is preferred
- AES-128-GCM is accepted
- AES-CBC is accepted with a warning log (configure your IdP to use AES-GCM)
- 3DES-CBC and RSA-PKCS#1 v1.5 are rejected
Encrypted assertions achieve NIST SP 800-63C FAL2 (signed + encrypted).
Common Errors
Section titled “Common Errors”| Error code | Cause | Fix |
|---|---|---|
saml/connection_not_found | Entity ID mismatch or connection not active | Verify idp_config.entity_id matches the Issuer in IdP’s SAML Response |
saml/missing_email | IdP is not sending the email attribute | Add email attribute mapping in IdP |
saml/replay_detected | Same assertion submitted twice | Normal for retry attacks — investigate if seen in legitimate flows |
saml/invalid_relay_state | RelayState HMAC mismatch | Relay state was tampered with or expired (>10 min) |
saml/invalid_audience | AudienceRestriction ≠ SP Entity ID | Verify the SP Entity ID in IdP matches SAML_SP_ENTITY_ID |
saml/invalid_issuer | Issuer element ≠ idp_config.entity_id | Check that the connection’s entity_id matches the IdP’s entity ID exactly |
saml/idp_initiated_not_allowed | IdP sent unsolicited Response but idp_initiated_sso: false | Enable idp_initiated_sso in connection settings or use SP-initiated flow |