This guide walks you through creating and updating SAML configurations for individual tenants in your multi-tenant application. Each tenant can have their own Identity Provider (IdP) configuration, allowing for flexible SSO implementations.
Entity ID: https://yourdomain.com
ACS URL: https://yourdomain.com/saml/acs
SLS URL: https://yourdomain.com/saml/sls
Metadata URL: https://yourdomain.com/saml/metadata/{tenant-id}

.png)
Click the Import Metadata button in the top-right corner:
.png)
You have three options:
Best for: When you have downloaded metadata XML from your IdP
<!-- Example: onelogin_metadata.xml -->
<?xml version="1.0"?>
<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"...>
<!-- Metadata content -->
</EntityDescriptor>

Best for: When you have metadata XML in text format

Best for: IdPs that publish metadata at a URL
https://idp.example.com/metadata
https://yourcompany.okta.com/app/appid/sso/saml/metadata
https://login.microsoftonline.com/tenant-id/federationmetadata/2007-06/federationmetadata.xml

After import (or if configuring manually), you'll see populated fields:
A unique identifier for SAML configuration. Used in login URLs like /saml/login?code=company-name. If left empty, it will be generated from the company name.
.png)
| Field | Description | Example | Required |
|---|---|---|---|
| IdP Entity ID | Unique identifier for the IdP | https://idp.company.com |
Yes |
| IdP SSO URL | Where to redirect users for login | https://idp.company.com/sso |
Yes |
| IdP SLS URL | Single Logout Service URL | https://idp.company.com/slo |
No |
| IdP X.509 Certificate | Public certificate for signature validation | -----BEGIN CERTIFICATE-----... |
Yes |
Tips:
.png)
| Setting | Description | Default | When to Change |
|---|---|---|---|
| Force Re-authentication | Force users to re-enter credentials | Off | High-security apps |
| Passive Authentication | Don't force login if no session | Off | Embedded apps |
| Sign Authentication Requests | Digitally sign outgoing requests | On | Keep enabled |
| Sign Responses | Sign logout responses | On | Keep enabled |
| Setting | Description | Default | Recommendation |
|---|---|---|---|
| Encrypt NameID | Encrypt user identifier | Off | Enable for sensitive data |
| Encrypt Assertions | Encrypt entire SAML assertion | Off | Enable for high security |
Select how the IdP should identify users:
user@company.com
Controls how users are created and updated during SAML login.
Enable Auto-provisioning
Update User Attributes
| Setting | Description | Options | Example |
|---|---|---|---|
| Default Role | Role assigned to new users | Dropdown of available roles | "Tenant User" |
| Default Status | Initial user status | Active/Inactive | "Active" |

Maps SAML attributes to user fields in your system.
| System Field | Common SAML Attributes | Purpose |
|---|---|---|
email, mail, emailAddress |
User's login email | |
| firstname | firstName, givenName, fname |
First name |
| lastname | lastName, surname, sn |
Last name |
| name | displayName, fullName |
Full display name |
Example Custom Mappings:
department → Department
manager → ManagerEmail
employeeId → EmployeeNumber
phoneNumber → telephoneNumber

Download metadata from your IdP:
Import the file:
1. Click "Import Metadata"
2. Select "Upload File" tab
3. Choose your .xml file
4. Click "Import"
Verify imported data:
Perfect when you have the XML content but not as a file:
<!-- Copy this entire block from your IdP -->
<?xml version="1.0"?>
<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
entityID="https://idp.example.com">
<IDPSSODescriptor>
<KeyDescriptor use="signing">
<KeyInfo>
<X509Data>
<X509Certificate>MIIDpDCCA...</X509Certificate>
</X509Data>
</KeyInfo>
</KeyDescriptor>
<SingleSignOnService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://idp.example.com/sso"/>
</IDPSSODescriptor>
</EntityDescriptor>
Some IdPs publish metadata at a URL:
Common Metadata URLs:
# Okta
https://{yourOktaDomain}/app/{appId}/sso/saml/metadata
# Azure AD
https://login.microsoftonline.com/{tenant-id}/federationmetadata/2007-06/federationmetadata.xml
# ADFS
https://{adfs-server}/FederationMetadata/2007-06/FederationMetadata.xml
# Google Workspace
https://accounts.google.com/o/saml2/metadata?idpid={idp-id}
Click Save to store your configuration
https://yourdomain.com/saml/login/{tenant-id}In Okta Admin:
Applications → Create App Integration → SAML 2.0
Single Sign-On URL: https://yourdomain.com/saml/acs
Audience URI: https://yourdomain.com
Default RelayState: (leave blank)
Name ID format: EmailAddress
Application username: Email
Attribute Statements:
email → user.email
firstName → user.firstName
lastName → user.lastName
In Your App:
In Azure Portal:
Enterprise Applications → New Application → Non-gallery
Identifier: https://yourdomain.com
Reply URL: https://yourdomain.com/saml/acs
Sign-on URL: https://yourdomain.com/saml/login/{tenant-id}
User Attributes:
email → user.mail
firstName → user.givenname
lastName → user.surname
name → user.displayname
Import to Your App:
In Google Admin:
Apps → Web and mobile apps → Add custom SAML app
ACS URL: https://yourdomain.com/saml/acs
Entity ID: https://yourdomain.com
Start URL: https://yourdomain.com/saml/login/{tenant-id}
Attribute Mapping:
Primary Email → email
First Name → firstName
Last Name → lastName
In OneLogin Admin:
Applications → Add App → SAML Custom Connector (Advanced)
Audience: https://yourdomain.com
Recipient: https://yourdomain.com/saml/acs
ACS URL: https://yourdomain.com/saml/acs
Parameters:
Email → Email (SAML NameID)
FirstName → First Name
LastName → Last Name
IdP Certificate Rotation
URL Changes
Attribute Changes
Navigate to Configuration:
Click Edit/Update:
Test Before Saving:
Document Current Settings
Communicate Changes
Have Rollback Plan
Symptoms: Error after IdP login
Check:
Symptoms: SAML validates but user can't access
Solutions:
Symptoms: Security error
Solutions:
Symptoms: User info stays old
Check:
Check SAML Logs:
Settings → Logs → SAML Authentication
Validate Metadata:
Test with SAML Tracer:
# Generate new certificate
php yii saml/generate-certificate
# Validate metadata
php yii saml/validate-metadata {tenant-id}
# Clear SAML cache
php yii cache/flush saml