Overview
Thesso sub-client manages OIDC and SAML 2.0 enterprise connections,
domain-based enforcement, JIT provisioning, and sessions. It also exposes the
current LDAP direct-bind preview; that preview is not a general LDAP directory
integration and has the limitations documented below.
Enterprise SSO Connections
sso.createConnection()
Create a new SSO identity provider connection. You can create multiple connections for different domains or providers.SAML example
Parameters
The SSO protocol. Use
"oidc" for OpenID Connect, "saml" for SAML 2.0, or
"ldap" for the current LDAP direct-bind preview.Email domains to associate with this connection. Users with matching email domains are automatically routed to this IdP.
Enable just-in-time user provisioning. When
true, users are automatically created on first login. Defaults to false.Custom attribute mapping for SAML assertions. Maps Grantex fields to IdP attribute names.
Response: SsoConnection
The
clientSecret is never returned in responses. It is stored securely on the server.sso.listConnections()
List all SSO connections for your organization.Response: SsoConnectionList
sso.getConnection()
Retrieve a single SSO connection by ID.Parameters
Response
Returns anSsoConnection object.
sso.updateConnection()
Update an existing SSO connection.Parameters
Response
Returns the updatedSsoConnection object.
sso.deleteConnection()
Delete an SSO connection. Users associated with this connection will no longer be able to log in via SSO.Parameters
Response
Returnsvoid.
sso.testConnection()
Test an SSO connection to verify that the IdP configuration is correct and reachable.Parameters
Response: SsoTestResult
Enforcement
sso.setEnforcement()
Enforce SSO login for your organization. When enabled, all members must authenticate through an SSO connection.Parameters
Roles exempt from SSO enforcement (e.g.
["owner"]). Exempt users can still log in with API keys.Response: SsoEnforcement
Session Management
sso.listSessions()
List active SSO sessions for your organization.Response: SsoSessionList
Each SsoSession contains:
sso.revokeSession()
Revoke an active SSO session, forcing the user to re-authenticate.Parameters
Response
Returnsvoid.
Enterprise Login Flow
sso.getLoginUrl() (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.Parameters
Response: SsoLoginResponse
sso.handleOidcCallback()
Handle the callback from an OIDC identity provider. Exchanges the authorization code for user information and provisions the user if JIT is enabled.Parameters
Response: SsoCallbackResponse
sso.handleSamlCallback()
Handle the callback from a SAML 2.0 identity provider. Validates the SAML assertion and provisions the user if JIT is enabled.Parameters
Response
Returns the sameSsoCallbackResponse as handleOidcCallback().
sso.handleLdapCallback()
Authenticate a user with the LDAP direct-bind preview. Unlike OIDC and SAML, credentials are submitted directly. The built-in client binds a service account, constructs a user DN fromldapSearchFilter plus ldapSearchBase, and binds that
DN with the submitted password. It does not search entries, read attributes, or
retrieve group memberships.
Parameters
The username interpolated into the configured LDAP filter to construct the
user DN. The built-in preview does not perform a directory search.
Response
ReturnsSsoCallbackResult. With the built-in LDAP client, groups is empty,
name and email are null, and mappedScopes therefore contains only
configured default scopes.
LDAP credentials are never stored by Grantex. They are used only for the bind
operations and discarded after authentication. LDAP search, attribute
retrieval, group lookup/mapping, and broad provider compatibility are not
supported by the built-in preview client.
Full Enterprise SSO Flow Example
Legacy Single-Config Methods
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.
sso.createConfig()
Create or update the OIDC SSO configuration for your organization.Parameters
Response: SsoConfig
The
clientSecret is never returned in responses. It is stored securely on the server.sso.getConfig()
Retrieve the current SSO configuration (without the client secret).Response
Returns anSsoConfig object.
sso.deleteConfig()
Remove the SSO configuration. After deletion, SSO login is disabled for the organization.Response
Returnsvoid.