Skip to content

feat(backend): Deprecate domain field in favor of domains on SAML connections/account #6186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lucky-spoons-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/backend': minor
---

Deprecates `domain` field and introduce `domains`. Now, SAML connections support multiple domains, the `domain` field still supported but it's deprecated and will be removed on a future API version.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Deprecates `domain` field and introduce `domains`. Now, SAML connections support multiple domains, the `domain` field still supported but it's deprecated and will be removed on a future API version.
Introduces support for SAML connections with multiple domains, deprecating the `domain` field from `CreateSamlConnectionParams` and `UpdateSamlConnectionParams` in favor of `domains`.

4 changes: 4 additions & 0 deletions packages/backend/src/api/endpoints/SamlConnectionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ type SamlConnectionListParams = {
type CreateSamlConnectionParams = {
name: string;
provider: SamlIdpSlug;
/** @deprecated Use `domains` array instead. This field will be removed in a future API version. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Multiple lines for JSDocs, but like a pattern than anything else.

Suggested change
/** @deprecated Use `domains` array instead. This field will be removed in a future API version. */
/**
* @deprecated Use `domains` array instead. This field will be removed in a future API version.
*/

domain: string;
domains: string[];
organizationId?: string;
idpEntityId?: string;
idpSsoUrl?: string;
Expand All @@ -31,7 +33,9 @@ type CreateSamlConnectionParams = {
type UpdateSamlConnectionParams = {
name?: string;
provider?: SamlIdpSlug;
/** @deprecated Use `domains` array instead. This field will be removed in a future API version. */
domain?: string;
domains?: string[];
organizationId?: string;
idpEntityId?: string;
idpSsoUrl?: string;
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/api/resources/JSON.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ export interface SamlConnectionJSON extends ClerkResourceJSON {
object: typeof ObjectType.SamlConnection;
name: string;
domain: string;
domains: string[];
Comment on lines 633 to +634
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add deprecation comments here as well.

organization_id: string | null;
idp_entity_id: string;
idp_sso_url: string;
Expand Down Expand Up @@ -688,6 +689,7 @@ export interface SamlAccountConnectionJSON extends ClerkResourceJSON {
id: string;
name: string;
domain: string;
domains: string[];
active: boolean;
provider: string;
sync_user_attributes: boolean;
Expand Down
12 changes: 11 additions & 1 deletion packages/backend/src/api/resources/SamlConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ export class SamlConnection {
*/
readonly name: string,
/**
* The domain of your organization. Sign in flows using an email with this domain will use the connection.
* @deprecated The domain of your organization. Sign in flows using an email with this domain will use the connection.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @deprecated The domain of your organization. Sign in flows using an email with this domain will use the connection.
* @deprecated Use `domains` instead.

*/
readonly domain: string,
/**
* The domains of your organization. Sign in flows using an email with one of these domains will use the connection.
*/
readonly domains: string[],
/**
* The organization ID of the organization.
*/
Expand Down Expand Up @@ -95,6 +99,7 @@ export class SamlConnection {
data.id,
data.name,
data.domain,
data.domains,
data.organization_id,
data.idp_entity_id,
data.idp_sso_url,
Expand All @@ -121,7 +126,11 @@ export class SamlAccountConnection {
constructor(
readonly id: string,
readonly name: string,
/**
* @deprecated Use `domains` array instead. This field will be removed in a future version.
*/
readonly domain: string,
readonly domains: string[],
readonly active: boolean,
readonly provider: string,
readonly syncUserAttributes: boolean,
Expand All @@ -135,6 +144,7 @@ export class SamlAccountConnection {
data.id,
data.name,
data.domain,
data.domains,
data.active,
data.provider,
data.sync_user_attributes,
Expand Down
Loading