mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
chore: update saml application configs table schema
This commit is contained in:
parent
ce288354c7
commit
6faece8107
3 changed files with 12 additions and 16 deletions
|
@ -13,7 +13,8 @@ const alteration: AlterationScript = {
|
||||||
tenant_id varchar(21) not null
|
tenant_id varchar(21) not null
|
||||||
references tenants (id) on update cascade on delete cascade,
|
references tenants (id) on update cascade on delete cascade,
|
||||||
attribute_mapping jsonb /* @use SamlAttributeMapping */ not null default '{}'::jsonb,
|
attribute_mapping jsonb /* @use SamlAttributeMapping */ not null default '{}'::jsonb,
|
||||||
sp_metadata jsonb /* @use SamlSpMetadata */ not null,
|
entity_id varchar(128),
|
||||||
|
acs_url jsonb /* @use SamlAcsUrl */,
|
||||||
primary key (tenant_id, application_id),
|
primary key (tenant_id, application_id),
|
||||||
constraint application_type
|
constraint application_type
|
||||||
check (check_application_type(application_id, 'SAML'))
|
check (check_application_type(application_id, 'SAML'))
|
||||||
|
|
|
@ -7,23 +7,17 @@ export const samlAttributeMappingGuard = z.record(
|
||||||
z.string()
|
z.string()
|
||||||
) satisfies z.ZodType<SamlAttributeMapping>;
|
) satisfies z.ZodType<SamlAttributeMapping>;
|
||||||
|
|
||||||
|
// Only support SP HTTP-POST binding for now.
|
||||||
export enum BindingType {
|
export enum BindingType {
|
||||||
POST = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
|
POST = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
|
||||||
REDIRECT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SamlSpMetadata = {
|
export type SamlAcsUrl = {
|
||||||
entityId: string;
|
binding?: BindingType;
|
||||||
acsUrl: {
|
url: string;
|
||||||
binding: BindingType;
|
|
||||||
url: string;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const samlSpMetadataGuard = z.object({
|
export const samlAcsUrlGuard = z.object({
|
||||||
entityId: z.string(),
|
binding: z.nativeEnum(BindingType).optional().default(BindingType.POST),
|
||||||
acsUrl: z.object({
|
url: z.string(),
|
||||||
binding: z.nativeEnum(BindingType),
|
}) satisfies ToZodObject<SamlAcsUrl>;
|
||||||
url: z.string(),
|
|
||||||
}),
|
|
||||||
}) satisfies ToZodObject<SamlSpMetadata>;
|
|
||||||
|
|
|
@ -11,7 +11,8 @@ create table saml_application_configs (
|
||||||
tenant_id varchar(21) not null
|
tenant_id varchar(21) not null
|
||||||
references tenants (id) on update cascade on delete cascade,
|
references tenants (id) on update cascade on delete cascade,
|
||||||
attribute_mapping jsonb /* @use SamlAttributeMapping */ not null default '{}'::jsonb,
|
attribute_mapping jsonb /* @use SamlAttributeMapping */ not null default '{}'::jsonb,
|
||||||
sp_metadata jsonb /* @use SamlSpMetadata */ not null,
|
entity_id varchar(128),
|
||||||
|
acs_url jsonb /* @use SamlAcsUrl */,
|
||||||
primary key (tenant_id, application_id),
|
primary key (tenant_id, application_id),
|
||||||
constraint application_type
|
constraint application_type
|
||||||
check (check_application_type(application_id, 'SAML'))
|
check (check_application_type(application_id, 'SAML'))
|
||||||
|
|
Loading…
Reference in a new issue