mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
refactor: make SAML apps to be first party apps (#6913)
This commit is contained in:
parent
4191828fcb
commit
ced360b7a4
4 changed files with 32 additions and 7 deletions
|
@ -15,9 +15,10 @@ type Props = {
|
|||
};
|
||||
|
||||
const getIcon = (type: ApplicationType, isLightMode: boolean, isThirdParty?: boolean) => {
|
||||
// We have ensured that SAML applications are always third party in DB schema, we use `??` here to make TypeScript happy.
|
||||
// We have ensured that SAML applications are always third party in DB schema, we use `||` here to make TypeScript happy.
|
||||
// TODO: @darcy fix this when SAML application <Icon /> is ready
|
||||
if (isThirdParty ?? type === ApplicationType.SAML) {
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
if (isThirdParty || type === ApplicationType.SAML) {
|
||||
return isLightMode ? thirdPartyApplicationIcon : thirdPartyApplicationIconDark;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ export default function samlApplicationRoutes<T extends ManagementApiRouter>(
|
|||
description,
|
||||
customData,
|
||||
oidcClientMetadata: buildOidcClientMetadata(),
|
||||
isThirdParty: true,
|
||||
type: ApplicationType.SAML,
|
||||
})
|
||||
);
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
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 drop constraint check_saml_app_third_party_consistency;
|
||||
`);
|
||||
await pool.query(sql`
|
||||
update applications set is_third_party = false
|
||||
where type = 'SAML';
|
||||
`);
|
||||
},
|
||||
down: async (pool) => {
|
||||
await pool.query(sql`
|
||||
update applications set is_third_party = true
|
||||
where type = 'SAML';
|
||||
`);
|
||||
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));
|
||||
`);
|
||||
},
|
||||
};
|
||||
|
||||
export default alteration;
|
|
@ -17,10 +17,7 @@ create table applications (
|
|||
custom_data jsonb /* @use JsonObject */ not null default '{}'::jsonb,
|
||||
is_third_party boolean not null default false,
|
||||
created_at timestamptz not null default(now()),
|
||||
primary key (id),
|
||||
constraint check_saml_app_third_party_consistency check (
|
||||
type != 'SAML' OR (type = 'SAML' AND is_third_party = true)
|
||||
)
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
create index applications__id
|
||||
|
|
Loading…
Add table
Reference in a new issue