Overview
TheSSO service provides enterprise-grade single sign-on for your developer organization. It supports multiple identity provider connections (OIDC, SAML 2.0, and LDAP), domain-based enforcement, JIT (just-in-time) provisioning, and session management. Compatible with Okta, Azure AD, Google Workspace, Auth0, OneLogin, PingFederate, OpenLDAP, FreeIPA, and any SAML 2.0, OIDC, or LDAP-compliant provider.
Enterprise SSO Connections
Create Connection
Create a new SSO identity provider connection. You can create multiple connections for different domains or providers.SAML example
CreateSsoConnectionParams
| Field | Type | Required | Description |
|---|---|---|---|
Name | string | Yes | A human-readable name for this connection. |
Protocol | string | Yes | "oidc", "saml", or "ldap". |
IssuerURL | string | OIDC only | The OIDC issuer URL. |
ClientID | string | OIDC only | OAuth 2.0 client ID from your IdP. |
ClientSecret | string | OIDC only | OAuth 2.0 client secret from your IdP. |
MetadataURL | string | SAML only | The SAML metadata URL. |
AssertionConsumerServiceURL | string | SAML only | The SAML ACS URL. |
EntityID | string | SAML only | The SAML service provider entity ID. |
Domains | []string | No | Email domains to associate with this connection. |
JitProvisioning | bool | No | Enable just-in-time user provisioning. |
DefaultRole | string | No | Default role for JIT-provisioned users. |
AttributeMapping | map[string]string | No | Custom attribute mapping for SAML assertions. |
SsoConnection
| Field | Type | Description |
|---|---|---|
ID | string | Unique connection identifier. |
Name | string | The connection display name. |
Protocol | string | "oidc", "saml", or "ldap". |
Status | string | "active", "inactive", or "error". |
Domains | []string | Associated email domains. |
JitProvisioning | bool | Whether JIT provisioning is enabled. |
CreatedAt | string | ISO 8601 creation timestamp. |
UpdatedAt | string | ISO 8601 last-updated timestamp. |
Note: The ClientSecret is never returned in responses. It is stored securely on the server.
List Connections
List all SSO connections for your organization.Get Connection
Retrieve a single SSO connection by ID.Update Connection
Update an existing SSO connection.UpdateSsoConnectionParams
| Field | Type | Description |
|---|---|---|
Name | string | Updated display name. |
Domains | []string | Updated list of associated email domains. |
JitProvisioning | *bool | Enable or disable JIT provisioning. |
DefaultRole | string | Updated default role for JIT-provisioned users. |
AttributeMapping | map[string]string | Updated SAML attribute mapping. |
Delete Connection
Delete an SSO connection. Users associated with this connection will no longer be able to log in via SSO.Warning: Deleting a connection immediately disables SSO login for all users routed through it. Ensure you have an alternative authentication method configured before removing a connection.
Test Connection
Test an SSO connection to verify that the IdP configuration is correct and reachable.SsoTestResult
| Field | Type | Description |
|---|---|---|
Success | bool | Whether the connection test passed. |
Message | string | Human-readable result message. |
ResponseTime | int | IdP response time in milliseconds. |
Enforcement
Set Enforcement
Enforce SSO login for your organization. When enabled, all members must authenticate through an SSO connection.SsoEnforcementParams
| Field | Type | Required | Description |
|---|---|---|---|
Enforced | bool | Yes | Whether SSO login is enforced for all members. |
ExemptRoles | []string | No | Roles exempt from SSO enforcement. |
SsoEnforcement
| Field | Type | Description |
|---|---|---|
Enforced | bool | Whether SSO enforcement is active. |
ExemptRoles | []string | Roles exempt from the enforcement policy. |
Session Management
List Sessions
List active SSO sessions for your organization.SsoSession
| Field | Type | Description |
|---|---|---|
ID | string | Session identifier. |
Email | string | The user’s email address. |
ConnectionID | string | The SSO connection used for this session. |
ConnectionName | string | Display name of the SSO connection. |
CreatedAt | string | ISO 8601 session creation timestamp. |
ExpiresAt | string | ISO 8601 session expiration timestamp. |
Revoke Session
Revoke an active SSO session, forcing the user to re-authenticate.Enterprise Login Flow
Get Login URL (enterprise)
Get the SSO authorization URL for a user based on their email domain. The domain is matched against configured connections to route the user to the correct IdP.SsoLoginParams
| Field | Type | Required | Description |
|---|---|---|---|
Domain | string | Yes | Email domain to match against SSO connections. |
RedirectURI | string | No | Override the redirect URI for this login request. |
SsoLoginResponse (enterprise)
| Field | Type | Description |
|---|---|---|
AuthorizeURL | string | The full authorization URL. Redirect the user here. |
ConnectionID | string | The matched SSO connection ID. |
Protocol | string | The protocol of the matched connection. |
Handle OIDC Callback
Handle the callback from an OIDC identity provider. Exchanges the authorization code for user information and provisions the user if JIT is enabled.SsoOidcCallbackParams
| Field | Type | Required | Description |
|---|---|---|---|
Code | string | Yes | The authorization code from the OIDC callback. |
State | string | Yes | The state parameter for CSRF protection. |
SsoCallbackResponse
| Field | Type | Description |
|---|---|---|
Email | *string | The user’s email address from the IdP. |
Name | *string | The user’s display name from the IdP. |
Sub | *string | The user’s subject identifier from the IdP. |
DeveloperID | string | The Grantex developer ID. |
ConnectionID | string | The SSO connection that handled this authentication. |
Provisioned | bool | Whether the user was JIT-provisioned during this login. |
Handle SAML Callback
Handle the callback from a SAML 2.0 identity provider. Validates the SAML assertion and provisions the user if JIT is enabled.SsoSamlCallbackParams
| Field | Type | Required | Description |
|---|---|---|---|
SAMLResponse | string | Yes | The base64-encoded SAML response from the IdP. |
RelayState | string | No | The RelayState parameter from the SAML callback. |
SsoCallbackResponse as HandleOidcCallback().
Handle LDAP Callback
Authenticate a user via LDAP bind. Unlike OIDC and SAML which use browser redirects, LDAP authentication submits credentials directly. Grantex binds to the LDAP directory, verifies the user’s password, reads their attributes and group memberships, maps groups to scopes, and provisions the user if JIT is enabled.SsoLdapCallbackParams
| Field | Type | Required | Description |
|---|---|---|---|
Username | string | Yes | The user’s LDAP username (e.g. uid, sAMAccountName, or full DN). |
Password | string | Yes | The user’s LDAP password for bind authentication. |
ConnectionID | string | Yes | The SSO connection ID for the LDAP directory. |
SsoCallbackResponse as HandleOidcCallback().
Note: LDAP credentials are never stored by Grantex. They are used only for the bind operation and discarded immediately after authentication.
Full Enterprise SSO Flow Example
Legacy Single-Config Methods
Note: The following methods manage a single OIDC configuration per organization. They are retained for backward compatibility. For new integrations, use the enterprise connection methods above which support multiple IdPs, SAML, and domain-based routing.
Create Config
Get Config
Delete Config
Get Login URL (legacy)
Handle Callback
Legacy Types
SsoConfig
| Field | Type | Description |
|---|---|---|
IssuerURL | string | OIDC issuer URL |
ClientID | string | OAuth client ID |
RedirectURI | string | Callback URL |
CreatedAt | string | ISO 8601 timestamp |
UpdatedAt | string | ISO 8601 timestamp |