-
-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6067 from logto-io/gao-org-jit-sso
feat(core): organization jit sso apis
- Loading branch information
Showing
8 changed files
with
269 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
packages/core/src/routes/organization/index.jit.sso-connectors.openapi.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"tags": [ | ||
{ | ||
"name": "Organizations" | ||
} | ||
], | ||
"paths": { | ||
"/api/organizations/{id}/jit/sso-connectors": { | ||
"get": { | ||
"summary": "Get organization JIT SSO connectors", | ||
"description": "Get enterprise SSO connectors for just-in-time provisioning of users in the organization.", | ||
"responses": { | ||
"200": { | ||
"description": "A list of SSO connectors." | ||
} | ||
} | ||
}, | ||
"post": { | ||
"summary": "Add organization JIT SSO connectors", | ||
"description": "Add new enterprise SSO connectors for just-in-time provisioning of users in the organization.", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"properties": { | ||
"ssoConnectorIds": { | ||
"description": "The SSO connector IDs to add." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"201": { | ||
"description": "The SSO connectors were added successfully." | ||
}, | ||
"422": { | ||
"description": "The SSO connectors could not be added. Some of the SSO connectors may not exist." | ||
} | ||
} | ||
}, | ||
"put": { | ||
"summary": "Replace organization JIT SSO connectors", | ||
"description": "Replace all enterprise SSO connectors for just-in-time provisioning of users in the organization with the given data.", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"properties": { | ||
"ssoConnectorIds": { | ||
"description": "An array of SSO connector IDs to replace existing SSO connectors." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"204": { | ||
"description": "The SSO connectors were replaced successfully." | ||
}, | ||
"422": { | ||
"description": "The SSO connectors could not be replaced. Some of the SSO connectors may not exist." | ||
} | ||
} | ||
} | ||
}, | ||
"/api/organizations/{id}/jit/sso-connectors/{ssoConnectorId}": { | ||
"delete": { | ||
"summary": "Remove organization JIT SSO connector", | ||
"description": "Remove an enterprise SSO connector for just-in-time provisioning of users in the organization.", | ||
"responses": { | ||
"204": { | ||
"description": "The SSO connector was removed successfully." | ||
}, | ||
"422": { | ||
"description": "The SSO connector could not be removed. The SSO connector may not exist." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/schemas/alterations/next-1718786576-organization-jit-sso-connectors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { sql } from '@silverhand/slonik'; | ||
|
||
import type { AlterationScript } from '../lib/types/alteration.js'; | ||
|
||
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js'; | ||
|
||
const alteration: AlterationScript = { | ||
up: async (pool) => { | ||
await pool.query(sql` | ||
create table organization_jit_sso_connectors ( | ||
tenant_id varchar(21) not null | ||
references tenants (id) on update cascade on delete cascade, | ||
/** The ID of the organization. */ | ||
organization_id varchar(21) not null | ||
references organizations (id) on update cascade on delete cascade, | ||
sso_connector_id varchar(128) not null | ||
references sso_connectors (id) on update cascade on delete cascade, | ||
primary key (tenant_id, organization_id, sso_connector_id) | ||
); | ||
`); | ||
await applyTableRls(pool, 'organization_jit_sso_connectors'); | ||
}, | ||
down: async (pool) => { | ||
await dropTableRls(pool, 'organization_jit_sso_connectors'); | ||
await pool.query(sql` | ||
drop table organization_jit_sso_connectors; | ||
`); | ||
}, | ||
}; | ||
|
||
export default alteration; |
13 changes: 13 additions & 0 deletions
13
packages/schemas/tables/organization_jit_sso_connectors.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* init_order = 2 */ | ||
|
||
/** The enterprise SSO connectors that will automatically assign users into an organization when they are authenticated via the SSO connector for the first time. */ | ||
create table organization_jit_sso_connectors ( | ||
tenant_id varchar(21) not null | ||
references tenants (id) on update cascade on delete cascade, | ||
/** The ID of the organization. */ | ||
organization_id varchar(21) not null | ||
references organizations (id) on update cascade on delete cascade, | ||
sso_connector_id varchar(128) not null | ||
references sso_connectors (id) on update cascade on delete cascade, | ||
primary key (tenant_id, organization_id, sso_connector_id) | ||
); |