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
|
||||
references tenants (id) on update cascade on delete cascade,
|
||||
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),
|
||||
constraint application_type
|
||||
check (check_application_type(application_id, 'SAML'))
|
||||
|
|
|
@ -7,23 +7,17 @@ export const samlAttributeMappingGuard = z.record(
|
|||
z.string()
|
||||
) satisfies z.ZodType<SamlAttributeMapping>;
|
||||
|
||||
// Only support SP HTTP-POST binding for now.
|
||||
export enum BindingType {
|
||||
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 = {
|
||||
entityId: string;
|
||||
acsUrl: {
|
||||
binding: BindingType;
|
||||
url: string;
|
||||
};
|
||||
export type SamlAcsUrl = {
|
||||
binding?: BindingType;
|
||||
url: string;
|
||||
};
|
||||
|
||||
export const samlSpMetadataGuard = z.object({
|
||||
entityId: z.string(),
|
||||
acsUrl: z.object({
|
||||
binding: z.nativeEnum(BindingType),
|
||||
url: z.string(),
|
||||
}),
|
||||
}) satisfies ToZodObject<SamlSpMetadata>;
|
||||
export const samlAcsUrlGuard = z.object({
|
||||
binding: z.nativeEnum(BindingType).optional().default(BindingType.POST),
|
||||
url: z.string(),
|
||||
}) satisfies ToZodObject<SamlAcsUrl>;
|
||||
|
|
|
@ -11,7 +11,8 @@ create table saml_application_configs (
|
|||
tenant_id varchar(21) not null
|
||||
references tenants (id) on update cascade on delete cascade,
|
||||
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),
|
||||
constraint application_type
|
||||
check (check_application_type(application_id, 'SAML'))
|
||||
|
|
Loading…
Reference in a new issue