Overview
This guide covers all authentication features including OIDC, OAuth2, SAML 2.0, database-backed provider management, JIT provisioning, role mapping, user management, and audit logging.Configuration methods
Database-backed providers (recommended)
Manage providers through the admin UI without server restarts:- Changes take effect immediately
- No server restarts required
- Web-based configuration at
/admin/sso_providers - Audit trail for all changes
YAML-based providers (legacy)
Configure providers inconfig/auth.yml. Requires server restart for changes.
We recommend migrating to database-backed providers. See the migration section below.
OIDC configuration
Supported providers
OIDC works with any compliant provider:- Google Workspace
- Microsoft Entra ID (Azure AD)
- Okta
- Auth0
- Keycloak
- Authentik
- GitLab
Basic OIDC setup
1
Create OAuth client in your IdP
Configure redirect URI:
2
Add provider in admin UI
Navigate to
/admin/sso_providers and click Add Provider:3
Configure role mapping
Set default roles and group mappings (optional)
4
Test the integration
Use the test login flow to verify configuration
Multiple OIDC providers
Configure multiple providers simultaneously (e.g., Keycloak + Authentik):name field, which determines the callback URL path.
OAuth2 configuration
Use OAuth2 for providers without OIDC support (GitHub, GitLab, Discord, Slack).GitHub example
1
Create OAuth App
2
Configure in admin UI
Token endpoint authentication
The application supports multiple authentication methods:client_secret_post(default): Send credentials in request bodyclient_secret_basic: Send credentials in Authorization header
SAML 2.0 configuration
Service Provider metadata
Your application provides SAML metadata at:Okta SAML setup
1
Create SAML application
In Okta admin console:
- Go to Applications → Create App Integration
- Select SAML 2.0
2
Configure SAML settings
3
Configure attribute statements
4
Get IdP metadata
Copy:
- Identity Provider Single Sign-On URL
- Identity Provider Issuer
- X.509 Certificate
5
Configure in admin UI
Azure AD SAML setup
1
Create enterprise application
- Go to Microsoft Entra ID → Enterprise applications
- Click New application → Create your own application
- Select Integrate any other application (Non-gallery)
2
Configure SAML
3
Configure attributes
4
Download metadata
Download Certificate (Base64) and copy Login URL and Azure AD Identifier
Database-backed provider management
Admin UI features
Access at/admin/sso_providers:
- Add, edit, delete providers without server restarts
- Enable/disable providers with a toggle
- Test login flows before enabling
- View callback URLs with copy button
- Encrypted storage of client secrets
- Audit trail of all changes
Security features
- Client secrets encrypted at rest using Rails 7.2 ActiveRecord Encryption
- Rate limiting: 10 requests/minute per IP on admin endpoints
- Discovery endpoint validation for OIDC providers
- Issuer validation to prevent impersonation attacks
- Super admin role required for provider management
Seeding providers from YAML
Migrate existing YAML configuration to database:Migration workflow
1
Backup configuration
2
Run migrations
3
Seed providers
4
Enable database source
5
Restart application
6
Verify
Check logs for:
[ProviderLoader] Loaded N provider(s) from databaseLocal login control
Disable local login (SSO-only)
- Email/password form hidden
POST /sessionswith local credentials blocked- Password reset routes disabled
- Users must authenticate via SSO
Emergency admin override
Allow super admins to log in locally during IdP outages:- Login page shows email/password form with admin-only note
- Super admins can log in with local passwords
- Regular users are blocked
- Override logins are logged
JIT user provisioning
Provisioning modes
Domain restrictions
Default roles
Configure in admin UI under Role Mapping:- Default Role: Assigned to all JIT-created users (e.g.,
member) - Group Mappings: Map IdP groups to application roles
Role mapping
Group-to-role mapping
Map identity provider groups to application roles:super_admin > admin > member).
OIDC group mapping
Ensure your OIDC provider includes groups:SAML attribute mapping
Configure group attribute in SAML provider:Role synchronization
Roles are synchronized on every login:- Fetch current groups from IdP
- Apply group-to-role mappings
- Update user’s roles
- Remove roles no longer mapped
/admin/users → Sync Roles from SSO.
User management
Admin interface
Access at/admin/users:
- View all users with roles, auth methods, last login
- Search and filter by role, provider, status
- View connected SSO accounts
- Manage user roles manually
- Suspend/reactivate/delete users
- View authentication history
Connected accounts
Users can manage their own connected accounts at/settings/security:
- View all connected SSO providers
- Connect additional providers
- Disconnect providers (if alternative login exists)
- See last used timestamp
User actions
Suspend user: Temporarily disable accessAudit logging
Event types
Access logs at/admin/sso_audit_logs:
Authentication events:
login: Successful SSO loginlogin_failed: Failed login attemptlogout: User logoutlogout_idp: RP-initiated federated logoutlink: SSO account linked to userunlink: SSO account unlinkedjit_account_created: New account created via JIT provisioning
Log retention
- Standard: 90 days in database
- Extended: 1 year (database + archive)
- Compliance: 7 years (archive storage)
Monitoring
Set up alerts for:- Multiple failed login attempts (brute force detection)
- Provider configuration changes
- Unusual login locations
- Role escalations
Troubleshooting
Provider not appearing on login page
YAML mode:- Check required environment variables are set (
OIDC_ISSUER,OIDC_CLIENT_ID,OIDC_CLIENT_SECRET)
- Verify provider is enabled in
/admin/sso_providers - Check
AUTH_PROVIDERS_SOURCE=dbis set - Review application logs for provider loading messages
Discovery endpoint validation fails
When adding an OIDC provider:- Ensure issuer URL is correct and accessible
- Check firewall rules allow outbound HTTPS
- Verify issuer returns valid JSON with
issuerfield - For self-signed certificates, configure SSL verification
Callback URL mismatch
Each provider requires exact callback URL match: Format:https://yourdomain.com/auth/<provider_name>/callback
Examples:
- Keycloak:
https://yourdomain.com/auth/keycloak/callback - Google:
https://yourdomain.com/auth/google_oauth2/callback - SAML:
https://yourdomain.com/auth/okta-saml/callback
Groups not syncing
- Add
groupsscope to OIDC configuration - Verify IdP includes groups in token/assertion
- Check group attribute name matches IdP configuration
- Review audit logs to see what groups are received
- Some IdPs require additional configuration to include groups
Security considerations
Encryption
- Client secrets encrypted at rest using Rails 7.2 ActiveRecord Encryption
- Encryption keys derived from
SECRET_KEY_BASE - For additional security, set custom encryption keys via
ACTIVE_RECORD_ENCRYPTION_*variables
Issuer validation
- OIDC identities store the issuer claim from ID token
- On subsequent logins, issuer is verified against configured provider
- Prevents issuer impersonation attacks
Admin access
- SSO provider management requires
super_adminrole - Regular
adminusers (family admins) cannot access/admin/sso_providers - All provider changes logged with user ID
Rate limiting
- Admin endpoints: 10 requests/minute per IP
- OAuth token endpoint: 10 requests/minute per IP
- Failed login attempts monitored separately
Example configurations
Default hybrid (local + SSO)
Pure SSO-only
SSO-only with emergency admin override
Link-only JIT + restricted domains
Advanced features
Request signing (SAML)
Generate key pair:- Toggle “Sign requests” to enabled
- Paste private key content
- Certificate automatically included in SP metadata
Custom attribute mapping
Map custom IdP attributes to application fields:Conditional role assignment
Assign roles based on multiple conditions:Role hierarchy
Define role hierarchies for automatic dependent roles:Best practices
Use OIDC when available
Use OIDC when available
OIDC provides standardized user information and better security than OAuth2.
Enable database-backed providers
Enable database-backed providers
Manage providers through admin UI for easier updates and no downtime.
Implement role mapping
Implement role mapping
Use group-to-role mapping to centralize access control in your IdP.
Monitor audit logs
Monitor audit logs
Regularly review authentication events and failed login attempts.
Rotate secrets regularly
Rotate secrets regularly
Periodically rotate client secrets and update in admin UI.
Test before enabling
Test before enabling
Always test provider configuration before enabling for all users.