supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.02k stars 201 forks source link

Support for Azure AD Single-Tenant Authentication in Supabase CLI #1320

Closed Frame1910 closed 5 months ago

Frame1910 commented 1 year ago

Describe the bug Azure AD auth provider doesn't take in a tenant url, and therefore cannot suport single-tenant applications. In order to authenticate with a single tenant application in Azure, the auth provider must hit the tenant-specific URL: "https://login.microsoftonline.com/" rather than the /common endpoint (which is only for multi-tenant applications)

To Reproduce Steps to reproduce the behavior:

  1. Setup local development for supabase as per docs
  2. Create app registration in Azure portal as per docs, except pick the single tenant option for supported account types:

image

  1. Add config options to config.toml as per docs:
    [auth.external.azure]
    enabled = true
    client_id = "env(SUPABASE_AZURE_CLIENT_ID)"
    secret = "env(SUPABASE_AZURE_CLIENT_SECRET)"
    redirect_uri = "https://localhost:3000"
  2. Try to login

Expected behavior You should be authenticated with Azure AD and the normal login flow continues. When you want to login to an internal, company-only application, single tenant is necessary for security (ie. only people with a company email address can authenticate), which is actually one of the main reasons people use Azure AD in the first place, rather than other OAuth providers.

Supabase proper already implements the tenant url: image I've verified that when using the "live" credentials that it works as expected.

Screenshots image

Desktop (please complete the following information):

Additional context N/A

sweatybridge commented 5 months ago

This has been resolved by https://github.com/supabase/cli/pull/473

example usage: https://github.com/supabase/cli/blob/develop/internal/utils/templates/init_config.test.toml#L144