This guide explains how to configure Single Sign-On (SSO) providers for TGM Manager. The application supports OAuth2, OpenID Connect (OIDC), and SAML 2.0 protocols.
Table of Contents¶
- Overview
- Prerequisites
- Adding an OAuth2/OIDC Provider
- Google Workspace
- Microsoft Azure AD
- Okta
- Generic OIDC Provider
- Adding a SAML Provider
- Azure AD SAML
- Okta SAML
- Generic SAML Provider
- API Reference
- User Provisioning
- Troubleshooting
Overview¶
TGM Manager supports enterprise SSO allowing users to authenticate using their corporate identity provider. Supported protocols:
| Protocol | Use Case |
|---|---|
| OAuth2 | Social logins, simple authorization |
| OIDC | Enterprise identity (Google, Azure AD, Okta) |
| SAML 2.0 | Enterprise federation, legacy systems |
How SSO Login Works¶
1. User clicks "Sign in with [Provider]" on login page
2. User is redirected to the identity provider (IdP)
3. User authenticates at the IdP
4. IdP redirects back to TGM Manager with authentication token
5. TGM Manager validates the token and creates a session
6. User is logged in (new account created if JIT provisioning enabled)
Prerequisites¶
Before configuring SSO, ensure you have:
- Admin access to TGM Manager
- Admin access to your identity provider (Google Admin, Azure Portal, etc.)
- The TGM Manager base URL (e.g.,
https://tgm.yourcompany.com)
Callback URLs¶
When configuring your IdP, you'll need these callback URLs:
| Protocol | Callback URL |
|---|---|
| OAuth2/OIDC | https://your-domain.com/auth/sso/callback/{providerId} |
| SAML ACS | https://your-domain.com/auth/sso/saml/acs |
| SAML Metadata | https://your-domain.com/auth/sso/saml/metadata |
Adding an OAuth2/OIDC Provider¶
Google Workspace¶
Step 1: Create OAuth2 Credentials in Google Cloud Console¶
- Go to Google Cloud Console
- Select or create a project
- Navigate to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Select Web application
- Add authorized redirect URI:
https://your-domain.com/auth/sso/callback/{providerId} - Copy the Client ID and Client Secret
Step 2: Configure in TGM Manager¶
# Login as admin
TOKEN=$(curl -s -X POST https://your-domain.com/auth/local \
-H "Content-Type: application/json" \
-d '{"identifier": "admin@yourcompany.com", "password": "your-password"}' \
| jq -r '.jwt')
# Create Google OIDC provider
curl -X POST https://your-domain.com/api/admin/identity-providers \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "google",
"displayName": "Sign in with Google",
"providerType": "OIDC",
"presetProvider": "GOOGLE",
"clientId": "YOUR_CLIENT_ID.apps.googleusercontent.com",
"clientSecret": "YOUR_CLIENT_SECRET",
"discoveryUri": "https://accounts.google.com/.well-known/openid-configuration",
"scopes": "openid profile email",
"enabled": true,
"jitEnabled": true,
"autoLinkByEmail": true
}'
Microsoft Azure AD¶
Step 1: Register Application in Azure Portal¶
- Go to Azure Portal
- Navigate to Azure Active Directory > App registrations
- Click New registration
- Enter a name (e.g., "TGM Manager SSO")
- Select Accounts in this organizational directory only (single tenant) or Accounts in any organizational directory (multi-tenant)
- Add redirect URI:
https://your-domain.com/auth/sso/callback/{providerId} - Click Register
- Copy the Application (client) ID
- Go to Certificates & secrets > New client secret
- Copy the secret value immediately (it won't be shown again)
Step 2: Configure in TGM Manager¶
# Create Azure AD OIDC provider
curl -X POST https://your-domain.com/api/admin/identity-providers \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "azure-ad",
"displayName": "Sign in with Microsoft",
"providerType": "OIDC",
"presetProvider": "AZURE_AD",
"clientId": "YOUR_APPLICATION_CLIENT_ID",
"clientSecret": "YOUR_CLIENT_SECRET",
"discoveryUri": "https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0/.well-known/openid-configuration",
"scopes": "openid profile email",
"enabled": true,
"jitEnabled": true,
"autoLinkByEmail": true,
"attributeMapping": {
"email": "email",
"firstName": "givenName",
"lastName": "surname",
"displayName": "displayName"
}
}'
Replace YOUR_TENANT_ID with your Azure AD tenant ID.
Okta¶
Step 1: Create OIDC Application in Okta¶
- Log in to your Okta Admin Console
- Go to Applications > Create App Integration
- Select OIDC - OpenID Connect and Web Application
- Configure:
- Sign-in redirect URI:
https://your-domain.com/auth/sso/callback/{providerId} - Sign-out redirect URI:
https://your-domain.com - Copy the Client ID and Client Secret
- Note your Okta domain (e.g.,
dev-123456.okta.com)
Step 2: Configure in TGM Manager¶
curl -X POST https://your-domain.com/api/admin/identity-providers \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "okta",
"displayName": "Sign in with Okta",
"providerType": "OIDC",
"presetProvider": "OKTA",
"clientId": "YOUR_CLIENT_ID",
"clientSecret": "YOUR_CLIENT_SECRET",
"discoveryUri": "https://YOUR_OKTA_DOMAIN/.well-known/openid-configuration",
"scopes": "openid profile email",
"enabled": true,
"jitEnabled": true
}'
Generic OIDC Provider¶
For any OIDC-compliant provider:
curl -X POST https://your-domain.com/api/admin/identity-providers \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "custom-oidc",
"displayName": "Corporate SSO",
"providerType": "OIDC",
"clientId": "YOUR_CLIENT_ID",
"clientSecret": "YOUR_CLIENT_SECRET",
"discoveryUri": "https://idp.yourcompany.com/.well-known/openid-configuration",
"scopes": "openid profile email",
"enabled": true,
"jitEnabled": true,
"attributeMapping": {
"email": "email",
"firstName": "given_name",
"lastName": "family_name",
"displayName": "name"
}
}'
If your provider doesn't support OIDC Discovery, manually specify endpoints:
curl -X POST https://your-domain.com/api/admin/identity-providers \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "custom-oauth",
"displayName": "Corporate SSO",
"providerType": "OAUTH2",
"clientId": "YOUR_CLIENT_ID",
"clientSecret": "YOUR_CLIENT_SECRET",
"authorizationUri": "https://idp.yourcompany.com/oauth/authorize",
"tokenUri": "https://idp.yourcompany.com/oauth/token",
"userInfoUri": "https://idp.yourcompany.com/oauth/userinfo",
"scopes": "openid profile email",
"enabled": true,
"jitEnabled": true
}'
Adding a SAML Provider¶
Get TGM Manager SP Metadata¶
First, download the Service Provider (SP) metadata to configure your IdP:
curl https://your-domain.com/auth/sso/saml/metadata > tgm-sp-metadata.xml
Or access it directly in your browser: https://your-domain.com/auth/sso/saml/metadata
SP Metadata contains:
- Entity ID: tgm-manager
- ACS URL: https://your-domain.com/auth/sso/saml/acs
- Supported NameID formats
Azure AD SAML¶
Step 1: Create Enterprise Application in Azure¶
- Go to Azure Portal
- Navigate to Azure Active Directory > Enterprise applications
- Click New application > Create your own application
- Name it (e.g., "TGM Manager SAML")
- Select Integrate any other application you don't find in the gallery (Non-gallery)
- Click Create
Step 2: Configure SAML¶
- Go to Single sign-on > Select SAML
- In Basic SAML Configuration:
- Identifier (Entity ID):
tgm-manager - Reply URL (ACS URL):
https://your-domain.com/auth/sso/saml/acs - In Attributes & Claims, configure:
emailaddress→ user.mailgivenname→ user.givennamesurname→ user.surnamename→ user.displayname- Download Certificate (Base64) from the SAML Signing Certificate section
- Copy the Login URL and Azure AD Identifier from Set up section
Step 3: Configure in TGM Manager¶
# Read the certificate file content
CERT=$(cat azure-certificate.cer)
curl -X POST https://your-domain.com/api/admin/identity-providers \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "azure-saml",
"displayName": "Sign in with Microsoft (SAML)",
"providerType": "SAML",
"entityId": "https://sts.windows.net/YOUR_TENANT_ID/",
"ssoUrl": "https://login.microsoftonline.com/YOUR_TENANT_ID/saml2",
"sloUrl": "https://login.microsoftonline.com/YOUR_TENANT_ID/saml2",
"idpCertificate": "-----BEGIN CERTIFICATE-----\nMIIC8D...YOUR_CERT...ABC123\n-----END CERTIFICATE-----",
"nameIdFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
"wantAssertionsSigned": true,
"enabled": true,
"jitEnabled": true,
"attributeMapping": {
"email": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",
"firstName": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname",
"lastName": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname",
"displayName": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"
}
}'
Okta SAML¶
Step 1: Create SAML Application in Okta¶
- Log in to Okta Admin Console
- Go to Applications > Create App Integration
- Select SAML 2.0
- Configure:
- Single sign-on URL:
https://your-domain.com/auth/sso/saml/acs - Audience URI (SP Entity ID):
tgm-manager - Name ID format: EmailAddress
- Configure attribute statements:
email→ user.emailfirstName→ user.firstNamelastName→ user.lastName- Complete the wizard and copy:
- Identity Provider Single Sign-On URL
- Identity Provider Issuer
- X.509 Certificate
Step 2: Configure in TGM Manager¶
curl -X POST https://your-domain.com/api/admin/identity-providers \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "okta-saml",
"displayName": "Sign in with Okta (SAML)",
"providerType": "SAML",
"entityId": "http://www.okta.com/YOUR_ENTITY_ID",
"ssoUrl": "https://YOUR_OKTA_DOMAIN/app/YOUR_APP_ID/sso/saml",
"idpCertificate": "-----BEGIN CERTIFICATE-----\n...YOUR_CERTIFICATE...\n-----END CERTIFICATE-----",
"nameIdFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
"wantAssertionsSigned": true,
"enabled": true,
"jitEnabled": true,
"attributeMapping": {
"email": "email",
"firstName": "firstName",
"lastName": "lastName"
}
}'
Generic SAML Provider¶
For any SAML 2.0 compliant IdP:
-
Import SP Metadata into your IdP from
https://your-domain.com/auth/sso/saml/metadata -
Export IdP Metadata or note down:
- IdP Entity ID
- SSO URL (Single Sign-On Service URL)
- SLO URL (Single Logout Service URL) - optional
-
X.509 Certificate
-
Configure in TGM Manager:
curl -X POST https://your-domain.com/api/admin/identity-providers \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "corporate-saml",
"displayName": "Corporate Login",
"providerType": "SAML",
"entityId": "https://idp.yourcompany.com/saml/metadata",
"ssoUrl": "https://idp.yourcompany.com/saml/sso",
"sloUrl": "https://idp.yourcompany.com/saml/slo",
"idpCertificate": "-----BEGIN CERTIFICATE-----\n...CERTIFICATE_CONTENT...\n-----END CERTIFICATE-----",
"signingAlgorithm": "RSA_SHA256",
"nameIdFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
"wantAssertionsSigned": true,
"wantAuthnRequestsSigned": true,
"enabled": true,
"jitEnabled": true,
"autoLinkByEmail": true,
"attributeMapping": {
"email": "email",
"firstName": "givenName",
"lastName": "sn",
"displayName": "cn"
}
}'
API Reference¶
Public Endpoints (No Authentication)¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /auth/sso/providers |
List available SSO providers |
| POST | /auth/sso/authorize |
Initiate SSO login flow |
| GET | /auth/sso/callback/{providerId} |
OAuth2/OIDC callback |
| POST | /auth/sso/saml/acs |
SAML Assertion Consumer Service |
| GET | /auth/sso/saml/metadata |
Get SP metadata XML |
Admin Endpoints (Requires Admin Role)¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/identity-providers |
List all providers |
| GET | /api/admin/identity-providers/{id} |
Get provider details |
| POST | /api/admin/identity-providers |
Create provider |
| PUT | /api/admin/identity-providers/{id} |
Update provider |
| DELETE | /api/admin/identity-providers/{id} |
Delete provider |
| POST | /api/admin/identity-providers/{id}/test |
Test connection |
| POST | /api/admin/identity-providers/discover |
OIDC discovery |
| GET | /api/admin/identity-providers/presets |
Get preset templates |
Authenticated User Endpoints¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /auth/sso/linked-accounts |
List linked SSO accounts |
| POST | /auth/sso/link |
Link SSO account |
| DELETE | /auth/sso/link/{providerId} |
Unlink SSO account |
User Provisioning¶
Just-In-Time (JIT) Provisioning¶
When jitEnabled: true, new users are automatically created on first SSO login:
{
"jitEnabled": true,
"jitDefaultRoleId": 2,
"jitDefaultProfileId": 1,
"autoLinkByEmail": true
}
- jitEnabled: Create new users automatically
- jitDefaultRoleId: Role to assign to new users
- jitDefaultProfileId: Profile to assign to new users
- autoLinkByEmail: Link existing users by matching email
Attribute Mapping¶
Map IdP attributes to TGM user fields:
{
"attributeMapping": {
"email": "email",
"firstName": "given_name",
"lastName": "family_name",
"displayName": "name",
"phoneNumber": "phone"
}
}
Common attribute names by provider:
| Field | Azure AD | Okta | SAML (typical) | |
|---|---|---|---|---|
| emailaddress | ||||
| First Name | given_name | givenName | firstName | givenName |
| Last Name | family_name | surname | lastName | sn |
| Display Name | name | displayName | displayName | cn |
Troubleshooting¶
Common Issues¶
"Invalid redirect URI" error¶
Cause: The redirect URI in your IdP doesn't match exactly.
Solution: Ensure the redirect URI matches exactly, including: - Protocol (https vs http) - Domain - Port (if non-standard) - Path
"Invalid state" error¶
Cause: The OAuth2 state parameter expired or was tampered with.
Solution: - Ensure user completes login within 10 minutes - Check for browser extensions blocking cookies
SAML "Invalid signature" error¶
Cause: Certificate mismatch between IdP and TGM Manager.
Solution: - Re-download the certificate from your IdP - Ensure the certificate is in PEM format - Check for line breaks in the certificate
User not created after SSO login¶
Cause: JIT provisioning disabled or email mismatch.
Solution:
- Enable jitEnabled: true
- Check attribute mapping for email
- Enable autoLinkByEmail to link existing accounts
Testing Connection¶
Test if your provider is configured correctly:
curl -X POST https://your-domain.com/api/admin/identity-providers/1/test \
-H "Authorization: Bearer $TOKEN"
Response:
{
"status": "success",
"message": "Successfully connected to OIDC provider",
"issuer": "https://accounts.google.com",
"testedAt": "2026-01-25T12:00:00"
}
Viewing Audit Logs¶
SSO events are logged for security auditing. Check application logs for:
- SSO_LOGIN_SUCCESS - Successful logins
- SSO_LOGIN_FAILED - Failed login attempts
- USER_PROVISIONED - New users created via JIT
- ACCOUNT_LINKED - SSO accounts linked to existing users
Security Best Practices¶
- Always use HTTPS for all SSO endpoints
- Rotate client secrets periodically
- Enable assertion signing for SAML (
wantAssertionsSigned: true) - Restrict allowed domains if needed (
allowedDomains: "yourcompany.com") - Monitor audit logs for suspicious activity
- Test thoroughly before enabling for all users
Support¶
For issues or questions: - Check the troubleshooting section above - Review application logs for detailed error messages - Contact your identity provider's support for IdP-specific issues