OIDC Configuration
OIDC Configuration
Section titled “OIDC Configuration”Configure OpenID Connect (OIDC) identity providers for enterprise Single Sign-On.
Overview
Section titled “Overview”Mantis uses OIDC 1.0 with Authorization Code flow and PKCE for secure authentication with external identity providers.
Creating an Identity Provider
Section titled “Creating an Identity Provider”API Request
Section titled “API Request”curl -X POST \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Okta Production", "provider_type": "oidc", "issuer_url": "https://company.okta.com", "client_id": "0oa1234567890abcdef", "client_secret": "your-client-secret-here", "scopes": ["openid", "profile", "email", "groups"], "auto_create_users": true, "default_role_id": "role_xyz789" }' \ "https://api.mantis.local/api/v1/admin/identity-providers"Request Fields
Section titled “Request Fields”| Field | Required | Description |
|---|---|---|
name | Yes | Unique display name |
provider_type | Yes | Must be "oidc" |
issuer_url | Yes | OIDC issuer URL |
client_id | Yes | OAuth client ID |
client_secret | Yes | OAuth client secret |
scopes | No | OAuth scopes (default: openid, profile, email) |
auto_create_users | No | Auto-provision users (default: false) |
default_role_id | No | Default role for new users |
Response
Section titled “Response”{ "id": "idp_abc123", "name": "Okta Production", "provider_type": "oidc", "issuer_url": "https://company.okta.com", "client_id": "0oa1234567890abcdef", "discovery_url": "https://company.okta.com/.well-known/openid-configuration", "endpoints": { "authorization_endpoint": "https://company.okta.com/oauth2/v1/authorize", "token_endpoint": "https://company.okta.com/oauth2/v1/token", "userinfo_endpoint": "https://company.okta.com/oauth2/v1/userinfo", "jwks_uri": "https://company.okta.com/oauth2/v1/keys" }, "scopes": ["openid", "profile", "email", "groups"], "is_enabled": true, "auto_create_users": true, "default_role_id": "role_xyz789", "default_role_name": "operator", "user_count": 0, "created_at": "2024-01-15T10:30:00Z", "updated_at": null}Provider-Specific Setup
Section titled “Provider-Specific Setup”-
Create Application in Okta Admin Console:
- Applications → Create App Integration
- Sign-in method: OIDC
- Application type: Web Application
-
Configure Settings:
Sign-in redirect URIs: https://your-mantis.com/api/v1/auth/oidc/callbackSign-out redirect URIs: https://your-mantis.comControlled access: Limit access to selected groups -
Enable PKCE (required):
- General → Edit
- Proof Key for Code Exchange (PKCE): Require PKCE
-
Add Groups Claim:
- Sign On → Edit OpenID Connect ID Token
- Groups claim type: Filter
- Groups claim filter:
groupsMatches regex.*
# Create Okta providercurl -X POST \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Okta", "provider_type": "oidc", "issuer_url": "https://dev-123456.okta.com", "client_id": "0oa...", "client_secret": "...", "scopes": ["openid", "profile", "email", "groups"], "auto_create_users": true }' \ "https://api.mantis.local/api/v1/admin/identity-providers"Azure AD (Microsoft Entra ID)
Section titled “Azure AD (Microsoft Entra ID)”-
Register Application in Azure Portal:
- App registrations → New registration
- Supported account types: Single tenant or Multi-tenant
- Redirect URI: Web →
https://your-mantis.com/api/v1/auth/oidc/callback
-
Configure Authentication:
- Authentication → Platform configurations → Web
- Implicit grant: Disable
- Allow public client flows: No
-
Create Client Secret:
- Certificates & secrets → New client secret
- Note the secret value immediately
-
API Permissions:
- API permissions → Add permission → Microsoft Graph
- Delegated:
openid,profile,email,User.Read
-
Token Configuration (for groups):
- Token configuration → Add groups claim
- Select: Security groups / All groups
# Create Azure AD providercurl -X POST \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Azure AD", "provider_type": "oidc", "issuer_url": "https://login.microsoftonline.com/{tenant-id}/v2.0", "client_id": "your-application-id", "client_secret": "your-client-secret", "scopes": ["openid", "profile", "email"], "auto_create_users": true }' \ "https://api.mantis.local/api/v1/admin/identity-providers"Keycloak
Section titled “Keycloak”-
Create Client in Keycloak Admin Console:
- Clients → Create client
- Client ID:
mantis - Client Protocol: openid-connect
-
Configure Client:
Access Type: confidentialStandard Flow Enabled: ONDirect Access Grants: OFFValid Redirect URIs: https://your-mantis.com/api/v1/auth/oidc/callback -
Get Client Secret:
- Credentials tab → Copy client secret
-
Configure Mappers (for groups):
- Mappers → Create
- Name: groups
- Mapper Type: Group Membership
- Token Claim Name: groups
- Add to ID token: ON
# Create Keycloak providercurl -X POST \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Keycloak", "provider_type": "oidc", "issuer_url": "https://keycloak.example.com/realms/your-realm", "client_id": "mantis", "client_secret": "your-client-secret", "scopes": ["openid", "profile", "email", "groups"], "auto_create_users": true }' \ "https://api.mantis.local/api/v1/admin/identity-providers"-
Create Application in Auth0 Dashboard:
- Applications → Create Application
- Application Type: Regular Web Applications
-
Configure Settings:
Allowed Callback URLs: https://your-mantis.com/api/v1/auth/oidc/callbackAllowed Logout URLs: https://your-mantis.comAllowed Web Origins: https://your-mantis.com -
Enable Connections:
- Connections → Enable database/social connections
# Create Auth0 providercurl -X POST \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Auth0", "provider_type": "oidc", "issuer_url": "https://your-tenant.auth0.com", "client_id": "your-client-id", "client_secret": "your-client-secret", "scopes": ["openid", "profile", "email"], "auto_create_users": true }' \ "https://api.mantis.local/api/v1/admin/identity-providers"Google Workspace
Section titled “Google Workspace”-
Create OAuth Client in Google Cloud Console:
- APIs & Services → Credentials → Create Credentials → OAuth client ID
- Application type: Web application
-
Configure Redirect URIs:
Authorized redirect URIs: https://your-mantis.com/api/v1/auth/oidc/callback
# Create Google providercurl -X POST \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Google Workspace", "provider_type": "oidc", "issuer_url": "https://accounts.google.com", "client_id": "123456789.apps.googleusercontent.com", "client_secret": "your-client-secret", "scopes": ["openid", "profile", "email"], "auto_create_users": true }' \ "https://api.mantis.local/api/v1/admin/identity-providers"Claim Configuration
Section titled “Claim Configuration”Common Claim Mappings
Section titled “Common Claim Mappings”| Provider | Groups | Username | |
|---|---|---|---|
| Okta | groups | preferred_username | email |
| Azure AD | groups | preferred_username | email |
| Keycloak | groups | preferred_username | email |
| Auth0 | https://your-app/roles | nickname | email |
| N/A | email | email |
Groups Claim Example
Section titled “Groups Claim Example”ID token with groups:
{ "iss": "https://company.okta.com", "sub": "00u1234567890", "aud": "0oa1234567890abcdef", "iat": 1704067200, "exp": 1704070800, "nonce": "abc123", "preferred_username": "alice@company.com", "email": "alice@company.com", "groups": ["Everyone", "Developers", "Mantis-Admins"]}Endpoint Discovery
Section titled “Endpoint Discovery”Automatic Discovery
Section titled “Automatic Discovery”Mantis automatically discovers OIDC endpoints from the issuer URL:
# Discover endpoints before creating providercurl -X POST \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "discovery_url": "https://company.okta.com" }' \ "https://api.mantis.local/api/v1/admin/identity-providers/discover"Response:
{ "success": true, "endpoints": { "authorization_endpoint": "https://company.okta.com/oauth2/v1/authorize", "token_endpoint": "https://company.okta.com/oauth2/v1/token", "userinfo_endpoint": "https://company.okta.com/oauth2/v1/userinfo", "jwks_uri": "https://company.okta.com/oauth2/v1/keys" }, "error": null}Manual Endpoint Configuration
Section titled “Manual Endpoint Configuration”For providers without discovery support:
curl -X POST \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Custom IdP", "provider_type": "oidc", "issuer_url": "https://custom-idp.example.com", "client_id": "mantis", "client_secret": "secret", "discovery_url": "https://custom-idp.example.com/custom-discovery" }' \ "https://api.mantis.local/api/v1/admin/identity-providers"Testing Configuration
Section titled “Testing Configuration”Connection Test
Section titled “Connection Test”Verify the provider configuration is correct:
curl -X POST \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{}' \ "https://api.mantis.local/api/v1/admin/identity-providers/$IDP_ID/test"Response:
{ "success": true, "message": "Connection successful - all endpoints discovered", "details": { "discovery_reachable": true, "authorization_reachable": true, "token_reachable": true, "jwks_reachable": true, "response_time_ms": 125 }}Test Login
Section titled “Test Login”After configuration, test the login flow:
- Navigate to Lens UI login page
- Click the SSO provider button
- Authenticate with IdP
- Verify redirect back to Mantis
Updating Configuration
Section titled “Updating Configuration”Update Provider
Section titled “Update Provider”curl -X PUT \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Okta Production (Updated)", "client_secret": "new-client-secret", "auto_create_users": false }' \ "https://api.mantis.local/api/v1/admin/identity-providers/$IDP_ID"Enable/Disable Provider
Section titled “Enable/Disable Provider”# Disable providercurl -X PUT \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"is_enabled": false}' \ "https://api.mantis.local/api/v1/admin/identity-providers/$IDP_ID"Client Secret Rotation
Section titled “Client Secret Rotation”Rotation Process
Section titled “Rotation Process”- Generate new secret in IdP admin console
- Update Mantis with new secret:
Terminal window curl -X PUT \-H "Authorization: Bearer $TOKEN" \-H "Content-Type: application/json" \-d '{"client_secret": "new-rotated-secret"}' \"https://api.mantis.local/api/v1/admin/identity-providers/$IDP_ID" - Test connection to verify
- Delete old secret in IdP admin console
Best Practices
Section titled “Best Practices”- Rotate secrets at least annually
- Use automated rotation where supported
- Monitor for authentication failures after rotation
Deleting Providers
Section titled “Deleting Providers”Prerequisites
Section titled “Prerequisites”Before deletion:
- Unlink all users from the provider
- Or migrate users to another provider
# Check linked userscurl -H "Authorization: Bearer $TOKEN" \ "https://api.mantis.local/api/v1/admin/identity-providers/$IDP_ID"# Check user_count field
# Delete provider (fails if users linked)curl -X DELETE \ -H "Authorization: Bearer $TOKEN" \ "https://api.mantis.local/api/v1/admin/identity-providers/$IDP_ID"Troubleshooting
Section titled “Troubleshooting”Discovery Failed
Section titled “Discovery Failed”Error: Failed to fetch OIDC discovery- Verify issuer URL is correct
- Check network connectivity to IdP
- Verify TLS certificates are valid
Invalid Client
Section titled “Invalid Client”Error: Token exchange failed: invalid_client- Verify client ID matches IdP configuration
- Verify client secret is correct
- Check token endpoint auth method
Redirect URI Mismatch
Section titled “Redirect URI Mismatch”Error: The redirect_uri does not match- Verify callback URL in IdP matches exactly:
https://your-mantis.com/api/v1/auth/oidc/callback
- Check for trailing slashes
- Verify protocol (http vs https)
Missing Claims
Section titled “Missing Claims”Error: ID token missing email claim- Check IdP configuration for claim mapping
- Verify requested scopes include
email - Update claim configuration in Mantis
Next Steps
Section titled “Next Steps”- SSO Setup - Complete authentication setup
- Role Mappings - Configure group-to-role mappings
- External Identities - Manage user links
