diff --git a/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx b/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx index 88fa007c523..b6c02804b92 100644 --- a/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx +++ b/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx @@ -74,6 +74,8 @@ Append `?download=true` to the Metadata URL to download the Metadata XML file. T Alternatively, you can use the `supabase sso info --remote=` [command](/docs/reference/cli/supabase-sso-info) to get setup information for your project. +These values are shared by every connection in your project. If your identity provider doesn't allow the same `EntityID` in more than one application, such as Microsoft Entra, use a [dedicated scope](#use-a-dedicated-scope-for-a-connection) for each connection. + ### User accounts and identities User accounts and identities created via SSO differ from regular (email, phone, password, social sign-in...) accounts in these ways: @@ -260,6 +262,37 @@ Calling [`SignInWithSSO`](/docs/reference/csharp/auth-signinwithsso) starts the +### Use a dedicated scope for a connection + +By default, every SAML connection in a project shares one `EntityID`, Metadata URL, and ACS URL. Microsoft Entra requires a unique `EntityID` for each application in a tenant, so the shared values work for only one Entra application. + +A connection with a dedicated scope has its own `EntityID`, Metadata URL, and ACS URL, so you can register one identity provider application for each connection. + +| Name | Shared (default) | Dedicated scope | +| --------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `EntityID` and Metadata URL | `https://YOUR_PROJECT_REF.supabase.co/auth/v1/sso/saml/metadata` | `https://YOUR_PROJECT_REF.supabase.co/auth/v1/sso/YOUR_PROVIDER_ID/saml/metadata` | +| ACS URL | `https://YOUR_PROJECT_REF.supabase.co/auth/v1/sso/saml/acs` | `https://YOUR_PROJECT_REF.supabase.co/auth/v1/sso/YOUR_PROVIDER_ID/saml/acs` | + +To set a dedicated scope, add the `--dedicated-scope` flag when you [add the connection](/docs/reference/cli/supabase-sso-add). You can't change it later with `supabase sso update`. + +```bash +supabase sso add --type saml --remote=YOUR_PROJECT_REF \ + --metadata-url 'https://company.com/idp/saml/metadata' \ + --domains company.com \ + --dedicated-scope +``` + +`supabase sso show YOUR_PROVIDER_ID --remote=YOUR_PROJECT_REF` prints the connection's `SP ENTITY ID` and `SP ACS URL`. `supabase sso info` prints only the shared values. + +#### Set up the identity provider application + +The dedicated URLs contain the provider ID, which exists only after you add the connection. If your identity provider needs the URLs when you create the application, such as Okta, start with the shared values and then switch: + +1. Create the application in the identity provider with the shared `EntityID` and ACS URL from `supabase sso info`. +2. Add the connection with `--dedicated-scope`, using the application's Metadata URL. +3. Run `supabase sso show` and copy the `SP ENTITY ID` and `SP ACS URL`. +4. Edit the application to use those values. + ### Understanding attribute mappings When a user signs in using the SAML 2.0 Single Sign-On protocol, an XML document called the SAML Assertion is exchanged between the identity provider and Supabase Auth. diff --git a/apps/docs/spec/cli_v1_commands.yaml b/apps/docs/spec/cli_v1_commands.yaml index 576b28934fc..9c4d24a78fb 100644 --- a/apps/docs/spec/cli_v1_commands.yaml +++ b/apps/docs/spec/cli_v1_commands.yaml @@ -4389,6 +4389,10 @@ commands: name: --attribute-mapping-file description: File containing a JSON mapping between SAML attributes to custom JWT claims. default_value: '' + - id: dedicated-scope + name: --dedicated-scope + description: Scope the SAML entity ID, metadata URL and ACS URL to this identity provider instead of the shared project-wide URLs. + default_value: 'false' - id: domains name: --domains description: Comma separated list of email domains to associate with the added identity provider.