-
-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…o-applications-table feat(schemas,core,console): add SAML application type
- Loading branch information
Showing
17 changed files
with
177 additions
and
37 deletions.
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
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
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
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
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
50 changes: 50 additions & 0 deletions
50
packages/schemas/alterations/next-1731900596-add-saml-application-type.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,50 @@ | ||
import { sql } from '@silverhand/slonik'; | ||
|
||
import type { AlterationScript } from '../lib/types/alteration.js'; | ||
|
||
const alteration: AlterationScript = { | ||
up: async (pool) => { | ||
await pool.query(sql` | ||
alter type application_type add value 'SAML'; | ||
`); | ||
}, | ||
down: async (pool) => { | ||
await pool.query(sql` | ||
alter table organization_application_relations drop constraint application_type; | ||
alter table application_secrets drop constraint application_type; | ||
alter table sso_connector_idp_initiated_auth_configs drop constraint application_type; | ||
drop function check_application_type; | ||
create type application_type_new as enum ('Native', 'SPA', 'Traditional', 'MachineToMachine', 'Protected'); | ||
delete from applications where "type"='SAML'; | ||
alter table applications | ||
alter column "type" type application_type_new | ||
using ("type"::text::application_type_new); | ||
drop type application_type; | ||
alter type application_type_new rename to application_type; | ||
create function check_application_type( | ||
application_id varchar(21), | ||
variadic target_type application_type[] | ||
) returns boolean as | ||
$$ begin | ||
return (select type from applications where id = application_id) = any(target_type); | ||
end; $$ language plpgsql set search_path = public; | ||
alter table organization_application_relations | ||
add constraint application_type | ||
check (check_application_type(application_id, 'MachineToMachine')); | ||
alter table application_secrets | ||
add constraint application_type | ||
check (check_application_type(application_id, 'MachineToMachine', 'Traditional', 'Protected')); | ||
alter table sso_connector_idp_initiated_auth_configs | ||
add constraint application_type | ||
check (check_application_type(default_application_id, 'Traditional', 'SPA')); | ||
`); | ||
}, | ||
}; | ||
|
||
export default alteration; |
20 changes: 20 additions & 0 deletions
20
packages/schemas/alterations/next-1731900631-add-saml-app-third-party-consistency-check.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,20 @@ | ||
import { sql } from '@silverhand/slonik'; | ||
|
||
import type { AlterationScript } from '../lib/types/alteration.js'; | ||
|
||
const alteration: AlterationScript = { | ||
up: async (pool) => { | ||
await pool.query(sql` | ||
alter table applications | ||
add constraint check_saml_app_third_party_consistency | ||
check (type != 'SAML' OR (type = 'SAML' AND is_third_party = true)); | ||
`); | ||
}, | ||
down: async (pool) => { | ||
await pool.query(sql` | ||
alter table applications drop constraint check_saml_app_third_party_consistency; | ||
`); | ||
}, | ||
}; | ||
|
||
export default alteration; |
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
Oops, something went wrong.