Overview
Grantex supports OIDC and SAML 2.0 enterprise SSO, plus an LDAP direct-bind preview. You can configure multiple identity provider connections per organization, route users by email domain, and map OIDC/SAML groups to Grantex scopes. The built-in LDAP preview has the limitations described below. Key capabilities:Setting up OIDC
Step 1: Register Grantex in your IdP
In your identity provider (Okta, Azure AD, Google Workspace, Auth0, etc.), create a new application:- Application type: Web application
- Sign-in redirect URI:
https://grantex.dev/dashboard/sso/callbackfor the hosted dashboard, or your own callback URL for a custom integration - Scopes:
openid email profile - Grant type: Authorization Code
Step 2: Create the SSO connection
Step 3: Test the connection
Step 4: Handle the login flow
Setting up SAML 2.0
Step 1: Configure your IdP
In your SAML identity provider:- SP Entity ID:
urn:grantex:yourorg - ACS URL:
https://yourapp.com/sso/callback/saml - NameID format: Email address or persistent identifier
- Attributes: Map
email,displayName, andgroups
Step 2: Create the SAML connection
Step 3: Handle the SAML callback
Setting up LDAP
LDAP authentication differs from OIDC and SAML in that there is no browser redirect. The user submits credentials directly to your application, and Grantex performs a service-account bind followed by a user bind.Step 1: Gather LDAP server details
You will need the following from your directory administrator:- LDAP URL — The server address (e.g.
ldaps://ldap.mycompany.com:636for TLS orldap://ldap.mycompany.com:389) - Bind DN — The service-account distinguished name used for the initial connectivity/authentication bind (e.g.
cn=readonly,dc=mycompany,dc=com) - Bind password — The password for the bind DN
- Search base — The base DN appended to the constructed user RDN (e.g.
ou=people,dc=mycompany,dc=com) - Search filter — A template such as
(uid={{username}}). In the preview client this is not executed as a search; parentheses are removed and the result is used as the user RDN.
Step 2: Create the LDAP connection
Step 3: Handle LDAP authentication
Since LDAP does not use browser redirects, the user submits credentials directly to your application. Your backend then calls the LDAP callback endpoint:The preview performs two binds, not a directory search. It first binds the
configured service account, constructs the user DN, then binds that DN with
the submitted password. LDAP group-search settings are stored but are not
used by the built-in client; only
defaultScopes apply to its empty group list.Domain-based routing
When you assign domains to connections, Grantex automatically routes users to the correct IdP:Group-to-scope mapping
Map identity provider groups to Grantex scopes:['Engineering', 'ReadOnly'], they receive the union of matched scopes: ['read', 'write', 'deploy'].
JIT provisioning
WhenjitProvisioning is enabled, Grantex automatically creates or updates a principal (SCIM user) on each SSO login. This eliminates the need for manual user provisioning:
- User authenticates via SSO
- Grantex checks the IdP subject; after organization enforcement is enabled, it is namespaced by the connection ID to prevent cross-provider collisions
- If not found, creates a new SCIM user with the IdP’s email and display name
- If found, updates the existing user’s details
- Returns the
principalIdin the callback result
SSO enforcement
Human SSO enforcement is opt-in at two levels. The server operator setsSSO_HUMAN_ENFORCEMENT_ENABLED=true (source default: off). The organization
then enables its own policy in Dashboard > Settings > SSO or via the API:
admin scope. The hosted consent page requires a separate active
SSO session bound to the exact organization and principal for both approval
and denial. In live mode, the existing passkey requirement still applies;
SSO does not replace a WebAuthn assertion. Sessions expire after eight hours
and may be revoked earlier. Consent fails closed on missing, expired,
revoked, or other-principal sessions.
The developer API key deliberately continues to authorize programmatic
management API calls. It cannot impersonate a principal SSO session for
consent, but a key holder can still manage the organization, including
turning enforcement off. Protect it as a privileged machine credential;
this policy is not a blanket ban on non-SSO API access.
For a local end-to-end check, start the dedicated Docker stack with
docker compose -p grantex-sso-e2e -f docker-compose.yml -f docker-compose.sso-test.yml up -d --build,
then run node apps/auth-service/scripts/sso-local-idp-e2e.mjs from the
repository root. This uses a disposable, locally signed OIDC test provider.
It does not certify any external identity provider or prove a live tenant’s
redirect and claim configuration. Validate the intended provider in staging
before enabling a production organization.
Session management
Track and manage active SSO sessions:sessionToken as a bearer
credential and keep it secret.
CLI reference
Supported identity providers
LDAP provider compatibility is not currently certified. The preview works only
when the configured filter and base construct the directory’s exact user DN;
test the intended server and schema before production use.