Your first SSO connection in 10 minutes
The operator's path from a running deployment to a person signed in through their company's identity provider. It is the sequence tested end to end on a real deployment (Cognito Lite) with Okta OIDC, Okta SAML, Entra OIDC, Entra SAML and Google. Each command took seconds; the DNS record verified in under a minute with a TTL of 300.
Names are provisional until the SSO naming review. Concepts: Enterprise SSO.
Before you start
-
A deployment with user-service and SSO on (
user-service.EnableSso=true; see Turn SSO on). -
Your login as the deployment's owner. Its access-admin role holds SSO management.
-
The identity provider's app, or an IT admin to create it. Each provider's steps are in its IT admin quickstart: Okta OIDC, Okta SAML, Entra OIDC, Entra SAML, Google.
-
Access to the company's DNS, or someone who can publish one TXT record.
-
A branded login domain, active, so every redirect and ACS URL you hand out is on your host (
auth.<space>.saaslayer-cloud.com, or your own such asauth.yourapp.com):saaslayer users login-domain provision managed --env prod --reason "branded login host" saaslayer users login-domain activate --confirm-domain <current-login-host> --reason "branded login host" --env prodsaaslayer users login-domain statusshows the active host. The examples below useauth.yourapp.saaslayer-cloud.com.
The example below is Okta OIDC. The other providers differ only in the sso add flags (step 3).
1. Sign in to the deployment
saaslayer login --deployment dep_0123abcdlogged in to deployment dep_0123abcd [dev] (user-service users) as you@example.com — control-plane login unchanged2. Create the company's tenant org
The connection belongs to one tenant: the org the company's people belong to.
saaslayer permissions orgs create "Acme" --api-base https://<permissions-api-base> --deployment dep_0123abcd{
"id": "org_01…",
"name": "Acme",
…
}3. Create the connection
The connection starts as a draft. --org lists the orgs it may add people to.
saaslayer sso create --tenant org_01… --protocol oidc --issuer https://acme.okta.com/oauth2/default \
--client-id <okta-client-id> --client-secret-stdin --domain acme.com --subject-source sub \
--oidc-scope openid --oidc-scope email --oidc-scope profile --oidc-scope groups --allowed-org org_01… < okta-client-secret.txtcreated SSO connection conn_0123456789abcdef0123 (oidc, draft) for tenant org_01… on user-service of dep_0123abcd
publish these DNS records, then check them with saaslayer sso domains verify:
TXT _saaslayer-sso.acme.com "saaslayer-sso-verification=<token>"
note (namespace): issuer, providerTenant, subjectSource and idp.clientId lock at the first activation: …
note (tier): SSO runs the pool on Cognito Essentials with V1 claims: the sso_* claims are flat strings in ID tokens only. …
next: saaslayer sso domains verify conn_0123456789abcdef0123 <domain>, then saaslayer sso activate conn_0123456789abcdef0123 …The flags for the other providers:
| Provider | sso add flags |
|---|---|
| Okta OIDC | --protocol oidc --issuer https://<okta domain>/oauth2/<server> --subject-source sub, and --oidc-scope groups beside the defaults |
| Okta SAML | --protocol saml --issuer http://www.okta.com/<app key> --metadata-url https://<okta domain>/app/<app key>/sso/saml/metadata --subject-source nameid |
| Entra OIDC | --protocol oidc --issuer https://login.microsoftonline.com/<tenant id>/v2.0 --subject-source oid --provider-tenant <tenant id> |
| Entra SAML | --protocol saml --issuer https://sts.windows.net/<tenant id>/ --metadata-url <App Federation Metadata Url> --subject-source nameid --provider-tenant <tenant id> |
--protocol oidc --issuer https://accounts.google.com --subject-source sub |
The OIDC providers also take --client-id and --client-secret-stdin, and SAML takes --metadata-url or
--metadata-file. What the identity provider registers is the same for every connection of the deployment: the
redirect URI https://auth.yourapp.saaslayer-cloud.com/oauth2/idpresponse (OIDC), or the entity id urn:amazon:cognito:sp:<userPoolId> and
the ACS URL https://auth.yourapp.saaslayer-cloud.com/saml2/idpresponse (SAML), on your login host
(saaslayer users login-domain status shows it).
Or start blank and hand it to the IT admin
When the company's IT admin creates the identity provider's app, create the draft with only the tenant and the protocol. It prints what to register in the identity provider and what is still missing:
saaslayer sso create --tenant org_01… --protocol samlcreated SSO connection conn_0123456789abcdef0123 (saml, draft) for tenant org_01… on user-service of dep_0123abcd
register in the identity provider: entity id urn:amazon:cognito:sp:<userPoolId>, ACS URL https://auth.yourapp.saaslayer-cloud.com/saml2/idpresponse
note (setup): missing before activation: issuer (--issuer), idp.metadata (--metadata-url or --metadata-file)
…
next: saaslayer sso link issue conn_0123456789abcdef0123 hands the rest to the customer's IT admin (or set them with saaslayer sso update conn_0123456789abcdef0123), then saaslayer sso activate conn_0123456789abcdef0123Then send the IT admin a setup link:
saaslayer sso link issue conn_0123456789abcdef0123 --to-ssm /acme/sso-setup-linkThe setup page shows them the same values to register. They enter the issuer and the metadata (or the OIDC client id
and secret), add and verify the domain, and activate; their provider's IT admin quickstart walks through it. Until the
issuer and the provider's values are saved, activation is refused with SSO_CONNECTION_INCOMPLETE, naming what is
missing. Steps 4–7 below are then theirs; saaslayer sso status shows the progress.
4. Read what to register in the identity provider
saaslayer sso status conn_0123456789abcdef0123SSO connection conn_0123456789abcdef0123 (oidc, draft, version 1) for tenant org_01… on user-service of dep_0123abcd
issuer https://acme.okta.com/oauth2/default; sessions 12 h, tokens 5 min; MFA delegated; JIT on; SCIM off; delete policy keep_dormant_reinvite
health: inactive — sign-in idle; SCIM disabled
register in the identity provider: redirect URI https://auth.yourapp.saaslayer-cloud.com/oauth2/idpresponse
domain acme.com: pending — publish TXT _saaslayer-sso.acme.com "saaslayer-sso-verification=<token>"A SAML connection shows entity id urn:amazon:cognito:sp:<userPoolId>, ACS URL https://auth.yourapp.saaslayer-cloud.com/saml2/idpresponse
instead. Enter those in the identity provider's app (its IT admin quickstart says where).
5. Publish the TXT record
At the company's DNS provider:
_saaslayer-sso.acme.com TXT "saaslayer-sso-verification=<token>" (TTL 300)6. Verify the domain
saaslayer sso domains verify conn_0123456789abcdef0123 acme.comacme.com: verified for conn_0123456789abcdef0123record-missing means DNS hasn't caught up yet: run it again in a minute.
7. Activate
saaslayer sso activate conn_0123456789abcdef0123activated SSO connection conn_0123456789abcdef0123: Cognito applied its provider and app client <app client id>
note (namespace): the identity namespace (issuer, providerTenant, subjectSource, idp.clientId) is now fixed: …8. Sign in
Open the app's sign-in page and enter an @acme.com email. Email-first sign-in finds the connection and sends the
browser to Cognito's authorize endpoint with identity_provider=sso-<connection hex>, so Cognito goes straight to the
identity provider. There is no Cognito screen. The person sees the identity provider's page, showing your app's name and logo when the IT
admin set them (Your app's name and logo at the identity provider),
and the address bar shows your branded login host.
Switching login hosts later (saaslayer users login-domain activate or deactivate) moves the redirect and ACS URLs of
every connection (the entity id stays). The checklist activate prints names the URLs each identity provider must
register on the new host: add them beside the old ones first, and remove the old ones once sign-in works on the new host.
The ID token then carries, on Lite (redacted):
{
"sso_connection": "conn_0123456789abcdef0123",
"sso_tenant": "org_01…",
"sso_groups": "[\"acme-engineering\",\"acme-admins\"]",
"sso_groups_truncated": "false",
"custom:suid": "<suid>",
"custom:soid": "<suid>",
"exp": 1762550000,
"iat": 1762549701
}- The token lives 299 seconds (5-minute tokens), and the hosted refresh issues new ones until the 12-hour session cap.
- On Lite the
sso_*claims are in the ID token only, never the access token. - Google's
sso_groupsis"[]"withsso_groups_truncated"false": complete and empty, because Google sends no groups.
Check the result from the CLI:
saaslayer sso status conn_0123456789abcdef0123 # health: healthy — sign-in ok (last success …)
saaslayer sso audit conn_0123456789abcdef0123 # sign-in.admitted, or sign-in.refusedA refused sign-in records its reason code. saaslayer sso audit conn_0123456789abcdef0123 --type sign-in.refused --json
shows it under details.reason; SSO troubleshooting says what each one means.
Rules worth knowing on day one
- A domain belongs to one connection. Verifying a domain another connection owns is refused
(
SSO_DOMAIN_CLAIMED). To moveacme.comfrom connection A to B (tested end to end):saaslayer sso domains remove <A> acme.com, thensaaslayer sso domains add <B> acme.com, publish its new TXT record andsaaslayer sso domains verify <B> acme.com. - A connection only accepts emails in its verified domains. A contractor whose provider email is elsewhere is
refused (
domain-mismatch): invite them by email and they use native sign-in. - Get the subject right before you activate. The issuer, subject source, provider tenant and OIDC client id lock at the first activation; a wrong one needs a new connection.