@logto/schemas 1.19.0 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alterations/1.20.0-1723448981-personal-access-tokens.ts +35 -0
- package/alterations/1.20.0-1724229102-add-report-sub-updates-cloud-scope.ts +102 -0
- package/alterations/1.20.0-1724316971-add-verified-identifier-to-verification-statuses.ts +18 -0
- package/alterations/1.20.0-1725971571-add-verification-record.ts +35 -0
- package/alterations/1.21.0-1728357690-add-sso-connector-idp-initated-auth-configs-table.ts +40 -0
- package/alterations/1.21.0-1728526649-add-idp-initiated-saml-sso-sessions-table.ts +36 -0
- package/alterations/1.21.0-1728887713-add-client-idp-initiated-auth-callback-uri-columns.ts +40 -0
- package/alterations-js/1.20.0-1723448981-personal-access-tokens.js +30 -0
- package/alterations-js/1.20.0-1724229102-add-report-sub-updates-cloud-scope.js +59 -0
- package/alterations-js/1.20.0-1724316971-add-verified-identifier-to-verification-statuses.js +14 -0
- package/alterations-js/1.20.0-1725971571-add-verification-record.js +30 -0
- package/alterations-js/1.21.0-1728357690-add-sso-connector-idp-initated-auth-configs-table.js +35 -0
- package/alterations-js/1.21.0-1728526649-add-idp-initiated-saml-sso-sessions-table.js +31 -0
- package/alterations-js/1.21.0-1728887713-add-client-idp-initiated-auth-callback-uri-columns.js +36 -0
- package/lib/consts/experience.d.ts +8 -5
- package/lib/consts/experience.js +3 -0
- package/lib/consts/oidc.d.ts +34 -3
- package/lib/consts/oidc.js +26 -1
- package/lib/consts/subscriptions.d.ts +1 -0
- package/lib/consts/subscriptions.js +1 -0
- package/lib/db-entries/idp-initiated-saml-sso-session.d.ts +32 -0
- package/lib/db-entries/idp-initiated-saml-sso-session.js +42 -0
- package/lib/db-entries/index.d.ts +4 -0
- package/lib/db-entries/index.js +4 -0
- package/lib/db-entries/personal-access-token.d.ts +26 -0
- package/lib/db-entries/personal-access-token.js +41 -0
- package/lib/db-entries/sso-connector-idp-initiated-auth-config.d.ts +42 -0
- package/lib/db-entries/sso-connector-idp-initiated-auth-config.js +50 -0
- package/lib/db-entries/verification-record.d.ts +26 -0
- package/lib/db-entries/verification-record.js +42 -0
- package/lib/db-entries/verification-status.d.ts +3 -1
- package/lib/db-entries/verification-status.js +4 -0
- package/lib/foundations/jsonb-types/index.d.ts +1 -0
- package/lib/foundations/jsonb-types/index.js +1 -0
- package/lib/foundations/jsonb-types/logs.d.ts +3 -0
- package/lib/foundations/jsonb-types/logs.js +1 -0
- package/lib/foundations/jsonb-types/sign-in-experience.d.ts +7 -3
- package/lib/foundations/jsonb-types/sign-in-experience.js +5 -0
- package/lib/foundations/jsonb-types/sso-connector.d.ts +49 -0
- package/lib/foundations/jsonb-types/sso-connector.js +17 -0
- package/lib/foundations/jsonb-types/verification-records.d.ts +13 -0
- package/lib/foundations/jsonb-types/verification-records.js +14 -0
- package/lib/seeds/cloud-api.d.ts +4 -0
- package/lib/seeds/cloud-api.js +5 -0
- package/lib/types/connector.d.ts +8 -0
- package/lib/types/consent.d.ts +2 -2
- package/lib/types/interactions.d.ts +17 -15
- package/lib/types/interactions.js +5 -14
- package/lib/types/log/interaction.d.ts +3 -3
- package/lib/types/logto-config/jwt-customizer.d.ts +48 -0
- package/lib/types/logto-config/jwt-customizer.js +17 -0
- package/lib/types/sign-in-experience.d.ts +6 -2
- package/lib/types/sso-connector.d.ts +3 -0
- package/lib/types/sso-connector.js +4 -0
- package/lib/types/system.d.ts +20 -3
- package/lib/types/system.js +13 -0
- package/package.json +5 -5
- package/tables/idp_initiated_saml_sso_sessions.sql +16 -0
- package/tables/personal_access_tokens.sql +16 -0
- package/tables/sso_connector_idp_initiated_auth_configs.sql +24 -0
- package/tables/verification_records.sql +15 -0
- package/tables/verification_statuses.sql +1 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
|
|
6
|
+
|
|
7
|
+
const alteration: AlterationScript = {
|
|
8
|
+
up: async (pool) => {
|
|
9
|
+
await pool.query(sql`
|
|
10
|
+
create table personal_access_tokens (
|
|
11
|
+
tenant_id varchar(21) not null
|
|
12
|
+
references tenants (id) on update cascade on delete cascade,
|
|
13
|
+
user_id varchar(21) not null
|
|
14
|
+
references users (id) on update cascade on delete cascade,
|
|
15
|
+
/** The name of the secret. Should be unique within the user. */
|
|
16
|
+
name varchar(256) not null,
|
|
17
|
+
value varchar(64) not null,
|
|
18
|
+
created_at timestamptz not null default now(),
|
|
19
|
+
expires_at timestamptz,
|
|
20
|
+
primary key (tenant_id, user_id, name)
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
create index personal_access_token__value on personal_access_tokens (tenant_id, value);
|
|
24
|
+
`);
|
|
25
|
+
await applyTableRls(pool, 'personal_access_tokens');
|
|
26
|
+
},
|
|
27
|
+
down: async (pool) => {
|
|
28
|
+
await dropTableRls(pool, 'personal_access_tokens');
|
|
29
|
+
await pool.query(sql`
|
|
30
|
+
drop table personal_access_tokens;
|
|
31
|
+
`);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default alteration;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
import { generateStandardId } from './utils/1716643968-id-generation.js';
|
|
6
|
+
|
|
7
|
+
type Resource = {
|
|
8
|
+
tenantId: string;
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
indicator: string;
|
|
12
|
+
isDefault: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type Scope = {
|
|
16
|
+
tenantId: string;
|
|
17
|
+
id: string;
|
|
18
|
+
resourceId: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type Role = {
|
|
24
|
+
tenantId: string;
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const cloudApiIndicator = 'https://cloud.logto.io/api';
|
|
31
|
+
|
|
32
|
+
const cloudConnectionAppRoleName = 'tenantApplication';
|
|
33
|
+
|
|
34
|
+
const adminTenantId = 'admin';
|
|
35
|
+
|
|
36
|
+
const reportSubscriptionUpdatesScopeName = 'report:subscription:updates';
|
|
37
|
+
const reportSubscriptionUpdatesScopeDescription =
|
|
38
|
+
'Allow reporting changes on Stripe subscription to Logto Cloud.';
|
|
39
|
+
|
|
40
|
+
const alteration: AlterationScript = {
|
|
41
|
+
up: async (pool) => {
|
|
42
|
+
// Get the Cloud API resource
|
|
43
|
+
const cloudApiResource = await pool.maybeOne<Resource>(sql`
|
|
44
|
+
select * from resources
|
|
45
|
+
where tenant_id = ${adminTenantId}
|
|
46
|
+
and indicator = ${cloudApiIndicator}
|
|
47
|
+
`);
|
|
48
|
+
|
|
49
|
+
if (!cloudApiResource) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Get cloud connection application role
|
|
54
|
+
const tenantApplicationRole = await pool.one<Role>(sql`
|
|
55
|
+
select * from roles
|
|
56
|
+
where tenant_id = ${adminTenantId}
|
|
57
|
+
and name = ${cloudConnectionAppRoleName} and type = 'MachineToMachine'
|
|
58
|
+
`);
|
|
59
|
+
|
|
60
|
+
// Create the `report:subscription:updates` scope
|
|
61
|
+
const reportSubscriptionUpdatesCloudScope = await pool.one<Scope>(sql`
|
|
62
|
+
insert into scopes (id, tenant_id, resource_id, name, description)
|
|
63
|
+
values (${generateStandardId()}, ${adminTenantId}, ${
|
|
64
|
+
cloudApiResource.id
|
|
65
|
+
}, ${reportSubscriptionUpdatesScopeName}, ${reportSubscriptionUpdatesScopeDescription})
|
|
66
|
+
on conflict (tenant_id, name, resource_id) do nothing
|
|
67
|
+
returning *;
|
|
68
|
+
`);
|
|
69
|
+
|
|
70
|
+
// Assign the `report:subscription:updates` scope to cloud connection application role
|
|
71
|
+
await pool.query(sql`
|
|
72
|
+
insert into roles_scopes (id, tenant_id, role_id, scope_id)
|
|
73
|
+
values (${generateStandardId()}, ${adminTenantId}, ${tenantApplicationRole.id}, ${
|
|
74
|
+
reportSubscriptionUpdatesCloudScope.id
|
|
75
|
+
}) on conflict (tenant_id, role_id, scope_id) do nothing;
|
|
76
|
+
`);
|
|
77
|
+
},
|
|
78
|
+
down: async (pool) => {
|
|
79
|
+
// Get the Cloud API resource
|
|
80
|
+
const cloudApiResource = await pool.maybeOne<Resource>(sql`
|
|
81
|
+
select * from resources
|
|
82
|
+
where tenant_id = ${adminTenantId}
|
|
83
|
+
and indicator = ${cloudApiIndicator}
|
|
84
|
+
`);
|
|
85
|
+
|
|
86
|
+
if (!cloudApiResource) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Remove the `report:subscription:updates` scope
|
|
91
|
+
await pool.query(sql`
|
|
92
|
+
delete from scopes
|
|
93
|
+
where
|
|
94
|
+
tenant_id = ${adminTenantId} and
|
|
95
|
+
name = ${reportSubscriptionUpdatesScopeName} and
|
|
96
|
+
description = ${reportSubscriptionUpdatesScopeDescription} and
|
|
97
|
+
resource_id = ${cloudApiResource.id}
|
|
98
|
+
`);
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default alteration;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
await pool.query(sql`
|
|
8
|
+
alter table verification_statuses add column verified_identifier varchar(255);
|
|
9
|
+
`);
|
|
10
|
+
},
|
|
11
|
+
down: async (pool) => {
|
|
12
|
+
await pool.query(sql`
|
|
13
|
+
alter table verification_statuses drop column verified_identifier;
|
|
14
|
+
`);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default alteration;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
|
|
6
|
+
|
|
7
|
+
const alteration: AlterationScript = {
|
|
8
|
+
up: async (pool) => {
|
|
9
|
+
await pool.query(sql`
|
|
10
|
+
create table verification_records (
|
|
11
|
+
tenant_id varchar(21) not null
|
|
12
|
+
references tenants (id) on update cascade on delete cascade,
|
|
13
|
+
id varchar(21) not null,
|
|
14
|
+
user_id varchar(21)
|
|
15
|
+
references users (id) on update cascade on delete cascade,
|
|
16
|
+
created_at timestamptz not null default(now()),
|
|
17
|
+
expires_at timestamptz not null,
|
|
18
|
+
data jsonb /* @use VerificationRecordData */ not null default '{}'::jsonb,
|
|
19
|
+
primary key (id)
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
create index verification_records__id
|
|
23
|
+
on verification_records (tenant_id, id);
|
|
24
|
+
`);
|
|
25
|
+
await applyTableRls(pool, 'verification_records');
|
|
26
|
+
},
|
|
27
|
+
down: async (pool) => {
|
|
28
|
+
await dropTableRls(pool, 'verification_records');
|
|
29
|
+
await pool.query(sql`
|
|
30
|
+
drop table verification_records;
|
|
31
|
+
`);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default alteration;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
|
|
6
|
+
|
|
7
|
+
const alteration: AlterationScript = {
|
|
8
|
+
up: async (pool) => {
|
|
9
|
+
await pool.query(sql`
|
|
10
|
+
create table sso_connector_idp_initiated_auth_configs (
|
|
11
|
+
tenant_id varchar(21) not null
|
|
12
|
+
references tenants (id) on update cascade on delete cascade,
|
|
13
|
+
/** The globally unique identifier of the SSO connector. */
|
|
14
|
+
connector_id varchar(128) not null
|
|
15
|
+
references sso_connectors (id) on update cascade on delete cascade,
|
|
16
|
+
/** The default Logto application id. */
|
|
17
|
+
default_application_id varchar(21) not null
|
|
18
|
+
references applications (id) on update cascade on delete cascade,
|
|
19
|
+
/** OIDC sign-in redirect URI. */
|
|
20
|
+
redirect_uri text,
|
|
21
|
+
/** Additional OIDC auth parameters. */
|
|
22
|
+
auth_parameters jsonb /* @use IdpInitiatedAuthParams */ not null default '{}'::jsonb,
|
|
23
|
+
created_at timestamptz not null default(now()),
|
|
24
|
+
primary key (tenant_id, connector_id),
|
|
25
|
+
/** Insure the application type is Traditional. */
|
|
26
|
+
constraint application_type
|
|
27
|
+
check (check_application_type(default_application_id, 'Traditional'))
|
|
28
|
+
);
|
|
29
|
+
`);
|
|
30
|
+
await applyTableRls(pool, 'sso_connector_idp_initiated_auth_configs');
|
|
31
|
+
},
|
|
32
|
+
down: async (pool) => {
|
|
33
|
+
await dropTableRls(pool, 'sso_connector_idp_initiated_auth_configs');
|
|
34
|
+
await pool.query(sql`
|
|
35
|
+
drop table sso_connector_idp_initiated_auth_configs;
|
|
36
|
+
`);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default alteration;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
|
|
6
|
+
|
|
7
|
+
const alteration: AlterationScript = {
|
|
8
|
+
up: async (pool) => {
|
|
9
|
+
await pool.query(sql`
|
|
10
|
+
create table idp_initiated_saml_sso_sessions (
|
|
11
|
+
tenant_id varchar(21) not null
|
|
12
|
+
references tenants (id) on update cascade on delete cascade,
|
|
13
|
+
/** The globally unique identifier of the assertion record. */
|
|
14
|
+
id varchar(21) not null,
|
|
15
|
+
/** The identifier of the SAML SSO connector. */
|
|
16
|
+
connector_id varchar(128) not null
|
|
17
|
+
references sso_connectors (id) on update cascade on delete cascade,
|
|
18
|
+
/** The SAML assertion. */
|
|
19
|
+
assertion_content jsonb /* @use SsoSamlAssertionContent */ not null default '{}'::jsonb,
|
|
20
|
+
created_at timestamptz not null default(now()),
|
|
21
|
+
/** The expiration time of the assertion. */
|
|
22
|
+
expires_at timestamptz not null,
|
|
23
|
+
primary key (tenant_id, id)
|
|
24
|
+
);
|
|
25
|
+
`);
|
|
26
|
+
await applyTableRls(pool, 'idp_initiated_saml_sso_sessions');
|
|
27
|
+
},
|
|
28
|
+
down: async (pool) => {
|
|
29
|
+
await dropTableRls(pool, 'idp_initiated_saml_sso_sessions');
|
|
30
|
+
await pool.query(sql`
|
|
31
|
+
drop table idp_initiated_saml_sso_sessions;
|
|
32
|
+
`);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default alteration;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
await pool.query(sql`
|
|
8
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
9
|
+
add column client_idp_initiated_auth_callback_uri text;
|
|
10
|
+
|
|
11
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
12
|
+
add column auto_send_authorization_request boolean not null default false;
|
|
13
|
+
|
|
14
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
15
|
+
drop constraint application_type;
|
|
16
|
+
|
|
17
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
18
|
+
add constraint application_type
|
|
19
|
+
check (check_application_type(default_application_id, 'Traditional', 'SPA'));
|
|
20
|
+
`);
|
|
21
|
+
},
|
|
22
|
+
down: async (pool) => {
|
|
23
|
+
await pool.query(sql`
|
|
24
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
25
|
+
drop constraint application_type;
|
|
26
|
+
|
|
27
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
28
|
+
drop column client_idp_initiated_auth_callback_uri;
|
|
29
|
+
|
|
30
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
31
|
+
drop column auto_send_authorization_request;
|
|
32
|
+
|
|
33
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
34
|
+
add constraint application_type
|
|
35
|
+
check (check_application_type(default_application_id, 'Traditional'));
|
|
36
|
+
`);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default alteration;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
|
|
3
|
+
const alteration = {
|
|
4
|
+
up: async (pool) => {
|
|
5
|
+
await pool.query(sql `
|
|
6
|
+
create table personal_access_tokens (
|
|
7
|
+
tenant_id varchar(21) not null
|
|
8
|
+
references tenants (id) on update cascade on delete cascade,
|
|
9
|
+
user_id varchar(21) not null
|
|
10
|
+
references users (id) on update cascade on delete cascade,
|
|
11
|
+
/** The name of the secret. Should be unique within the user. */
|
|
12
|
+
name varchar(256) not null,
|
|
13
|
+
value varchar(64) not null,
|
|
14
|
+
created_at timestamptz not null default now(),
|
|
15
|
+
expires_at timestamptz,
|
|
16
|
+
primary key (tenant_id, user_id, name)
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
create index personal_access_token__value on personal_access_tokens (tenant_id, value);
|
|
20
|
+
`);
|
|
21
|
+
await applyTableRls(pool, 'personal_access_tokens');
|
|
22
|
+
},
|
|
23
|
+
down: async (pool) => {
|
|
24
|
+
await dropTableRls(pool, 'personal_access_tokens');
|
|
25
|
+
await pool.query(sql `
|
|
26
|
+
drop table personal_access_tokens;
|
|
27
|
+
`);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export default alteration;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
import { generateStandardId } from './utils/1716643968-id-generation.js';
|
|
3
|
+
const cloudApiIndicator = 'https://cloud.logto.io/api';
|
|
4
|
+
const cloudConnectionAppRoleName = 'tenantApplication';
|
|
5
|
+
const adminTenantId = 'admin';
|
|
6
|
+
const reportSubscriptionUpdatesScopeName = 'report:subscription:updates';
|
|
7
|
+
const reportSubscriptionUpdatesScopeDescription = 'Allow reporting changes on Stripe subscription to Logto Cloud.';
|
|
8
|
+
const alteration = {
|
|
9
|
+
up: async (pool) => {
|
|
10
|
+
// Get the Cloud API resource
|
|
11
|
+
const cloudApiResource = await pool.maybeOne(sql `
|
|
12
|
+
select * from resources
|
|
13
|
+
where tenant_id = ${adminTenantId}
|
|
14
|
+
and indicator = ${cloudApiIndicator}
|
|
15
|
+
`);
|
|
16
|
+
if (!cloudApiResource) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// Get cloud connection application role
|
|
20
|
+
const tenantApplicationRole = await pool.one(sql `
|
|
21
|
+
select * from roles
|
|
22
|
+
where tenant_id = ${adminTenantId}
|
|
23
|
+
and name = ${cloudConnectionAppRoleName} and type = 'MachineToMachine'
|
|
24
|
+
`);
|
|
25
|
+
// Create the `report:subscription:updates` scope
|
|
26
|
+
const reportSubscriptionUpdatesCloudScope = await pool.one(sql `
|
|
27
|
+
insert into scopes (id, tenant_id, resource_id, name, description)
|
|
28
|
+
values (${generateStandardId()}, ${adminTenantId}, ${cloudApiResource.id}, ${reportSubscriptionUpdatesScopeName}, ${reportSubscriptionUpdatesScopeDescription})
|
|
29
|
+
on conflict (tenant_id, name, resource_id) do nothing
|
|
30
|
+
returning *;
|
|
31
|
+
`);
|
|
32
|
+
// Assign the `report:subscription:updates` scope to cloud connection application role
|
|
33
|
+
await pool.query(sql `
|
|
34
|
+
insert into roles_scopes (id, tenant_id, role_id, scope_id)
|
|
35
|
+
values (${generateStandardId()}, ${adminTenantId}, ${tenantApplicationRole.id}, ${reportSubscriptionUpdatesCloudScope.id}) on conflict (tenant_id, role_id, scope_id) do nothing;
|
|
36
|
+
`);
|
|
37
|
+
},
|
|
38
|
+
down: async (pool) => {
|
|
39
|
+
// Get the Cloud API resource
|
|
40
|
+
const cloudApiResource = await pool.maybeOne(sql `
|
|
41
|
+
select * from resources
|
|
42
|
+
where tenant_id = ${adminTenantId}
|
|
43
|
+
and indicator = ${cloudApiIndicator}
|
|
44
|
+
`);
|
|
45
|
+
if (!cloudApiResource) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
// Remove the `report:subscription:updates` scope
|
|
49
|
+
await pool.query(sql `
|
|
50
|
+
delete from scopes
|
|
51
|
+
where
|
|
52
|
+
tenant_id = ${adminTenantId} and
|
|
53
|
+
name = ${reportSubscriptionUpdatesScopeName} and
|
|
54
|
+
description = ${reportSubscriptionUpdatesScopeDescription} and
|
|
55
|
+
resource_id = ${cloudApiResource.id}
|
|
56
|
+
`);
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
export default alteration;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
const alteration = {
|
|
3
|
+
up: async (pool) => {
|
|
4
|
+
await pool.query(sql `
|
|
5
|
+
alter table verification_statuses add column verified_identifier varchar(255);
|
|
6
|
+
`);
|
|
7
|
+
},
|
|
8
|
+
down: async (pool) => {
|
|
9
|
+
await pool.query(sql `
|
|
10
|
+
alter table verification_statuses drop column verified_identifier;
|
|
11
|
+
`);
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export default alteration;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
|
|
3
|
+
const alteration = {
|
|
4
|
+
up: async (pool) => {
|
|
5
|
+
await pool.query(sql `
|
|
6
|
+
create table verification_records (
|
|
7
|
+
tenant_id varchar(21) not null
|
|
8
|
+
references tenants (id) on update cascade on delete cascade,
|
|
9
|
+
id varchar(21) not null,
|
|
10
|
+
user_id varchar(21)
|
|
11
|
+
references users (id) on update cascade on delete cascade,
|
|
12
|
+
created_at timestamptz not null default(now()),
|
|
13
|
+
expires_at timestamptz not null,
|
|
14
|
+
data jsonb /* @use VerificationRecordData */ not null default '{}'::jsonb,
|
|
15
|
+
primary key (id)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
create index verification_records__id
|
|
19
|
+
on verification_records (tenant_id, id);
|
|
20
|
+
`);
|
|
21
|
+
await applyTableRls(pool, 'verification_records');
|
|
22
|
+
},
|
|
23
|
+
down: async (pool) => {
|
|
24
|
+
await dropTableRls(pool, 'verification_records');
|
|
25
|
+
await pool.query(sql `
|
|
26
|
+
drop table verification_records;
|
|
27
|
+
`);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export default alteration;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
|
|
3
|
+
const alteration = {
|
|
4
|
+
up: async (pool) => {
|
|
5
|
+
await pool.query(sql `
|
|
6
|
+
create table sso_connector_idp_initiated_auth_configs (
|
|
7
|
+
tenant_id varchar(21) not null
|
|
8
|
+
references tenants (id) on update cascade on delete cascade,
|
|
9
|
+
/** The globally unique identifier of the SSO connector. */
|
|
10
|
+
connector_id varchar(128) not null
|
|
11
|
+
references sso_connectors (id) on update cascade on delete cascade,
|
|
12
|
+
/** The default Logto application id. */
|
|
13
|
+
default_application_id varchar(21) not null
|
|
14
|
+
references applications (id) on update cascade on delete cascade,
|
|
15
|
+
/** OIDC sign-in redirect URI. */
|
|
16
|
+
redirect_uri text,
|
|
17
|
+
/** Additional OIDC auth parameters. */
|
|
18
|
+
auth_parameters jsonb /* @use IdpInitiatedAuthParams */ not null default '{}'::jsonb,
|
|
19
|
+
created_at timestamptz not null default(now()),
|
|
20
|
+
primary key (tenant_id, connector_id),
|
|
21
|
+
/** Insure the application type is Traditional. */
|
|
22
|
+
constraint application_type
|
|
23
|
+
check (check_application_type(default_application_id, 'Traditional'))
|
|
24
|
+
);
|
|
25
|
+
`);
|
|
26
|
+
await applyTableRls(pool, 'sso_connector_idp_initiated_auth_configs');
|
|
27
|
+
},
|
|
28
|
+
down: async (pool) => {
|
|
29
|
+
await dropTableRls(pool, 'sso_connector_idp_initiated_auth_configs');
|
|
30
|
+
await pool.query(sql `
|
|
31
|
+
drop table sso_connector_idp_initiated_auth_configs;
|
|
32
|
+
`);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export default alteration;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
|
|
3
|
+
const alteration = {
|
|
4
|
+
up: async (pool) => {
|
|
5
|
+
await pool.query(sql `
|
|
6
|
+
create table idp_initiated_saml_sso_sessions (
|
|
7
|
+
tenant_id varchar(21) not null
|
|
8
|
+
references tenants (id) on update cascade on delete cascade,
|
|
9
|
+
/** The globally unique identifier of the assertion record. */
|
|
10
|
+
id varchar(21) not null,
|
|
11
|
+
/** The identifier of the SAML SSO connector. */
|
|
12
|
+
connector_id varchar(128) not null
|
|
13
|
+
references sso_connectors (id) on update cascade on delete cascade,
|
|
14
|
+
/** The SAML assertion. */
|
|
15
|
+
assertion_content jsonb /* @use SsoSamlAssertionContent */ not null default '{}'::jsonb,
|
|
16
|
+
created_at timestamptz not null default(now()),
|
|
17
|
+
/** The expiration time of the assertion. */
|
|
18
|
+
expires_at timestamptz not null,
|
|
19
|
+
primary key (tenant_id, id)
|
|
20
|
+
);
|
|
21
|
+
`);
|
|
22
|
+
await applyTableRls(pool, 'idp_initiated_saml_sso_sessions');
|
|
23
|
+
},
|
|
24
|
+
down: async (pool) => {
|
|
25
|
+
await dropTableRls(pool, 'idp_initiated_saml_sso_sessions');
|
|
26
|
+
await pool.query(sql `
|
|
27
|
+
drop table idp_initiated_saml_sso_sessions;
|
|
28
|
+
`);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export default alteration;
|
package/alterations-js/1.21.0-1728887713-add-client-idp-initiated-auth-callback-uri-columns.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
const alteration = {
|
|
3
|
+
up: async (pool) => {
|
|
4
|
+
await pool.query(sql `
|
|
5
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
6
|
+
add column client_idp_initiated_auth_callback_uri text;
|
|
7
|
+
|
|
8
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
9
|
+
add column auto_send_authorization_request boolean not null default false;
|
|
10
|
+
|
|
11
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
12
|
+
drop constraint application_type;
|
|
13
|
+
|
|
14
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
15
|
+
add constraint application_type
|
|
16
|
+
check (check_application_type(default_application_id, 'Traditional', 'SPA'));
|
|
17
|
+
`);
|
|
18
|
+
},
|
|
19
|
+
down: async (pool) => {
|
|
20
|
+
await pool.query(sql `
|
|
21
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
22
|
+
drop constraint application_type;
|
|
23
|
+
|
|
24
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
25
|
+
drop column client_idp_initiated_auth_callback_uri;
|
|
26
|
+
|
|
27
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
28
|
+
drop column auto_send_authorization_request;
|
|
29
|
+
|
|
30
|
+
alter table sso_connector_idp_initiated_auth_configs
|
|
31
|
+
add constraint application_type
|
|
32
|
+
check (check_application_type(default_application_id, 'Traditional'));
|
|
33
|
+
`);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export default alteration;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export declare const experience: Readonly<{
|
|
2
|
-
routes: Readonly<{
|
|
3
|
-
signIn: "sign-in";
|
|
4
|
-
register: "register";
|
|
5
|
-
sso: "single-sign-on";
|
|
6
|
-
consent: "consent";
|
|
2
|
+
readonly routes: Readonly<{
|
|
3
|
+
readonly signIn: "sign-in";
|
|
4
|
+
readonly register: "register";
|
|
5
|
+
readonly sso: "single-sign-on";
|
|
6
|
+
readonly consent: "consent";
|
|
7
|
+
readonly resetPassword: "reset-password";
|
|
8
|
+
readonly identifierSignIn: "identifier-sign-in";
|
|
9
|
+
readonly identifierRegister: "identifier-register";
|
|
7
10
|
}>;
|
|
8
11
|
}>;
|
package/lib/consts/experience.js
CHANGED
|
@@ -3,6 +3,9 @@ const routes = Object.freeze({
|
|
|
3
3
|
register: 'register',
|
|
4
4
|
sso: 'single-sign-on',
|
|
5
5
|
consent: 'consent',
|
|
6
|
+
resetPassword: 'reset-password',
|
|
7
|
+
identifierSignIn: 'identifier-sign-in',
|
|
8
|
+
identifierRegister: 'identifier-register',
|
|
6
9
|
});
|
|
7
10
|
export const experience = Object.freeze({
|
|
8
11
|
routes,
|
package/lib/consts/oidc.d.ts
CHANGED
|
@@ -32,7 +32,24 @@ export declare enum ExtraParamsKey {
|
|
|
32
32
|
* Override the default sign-in experience configuration with the settings from the specified
|
|
33
33
|
* organization ID.
|
|
34
34
|
*/
|
|
35
|
-
OrganizationId = "organization_id"
|
|
35
|
+
OrganizationId = "organization_id",
|
|
36
|
+
/**
|
|
37
|
+
* Provides a hint about the login identifier the user might use.
|
|
38
|
+
* This can be used to pre-fill the identifier field **only on the first screen** of the sign-in/sign-up flow.
|
|
39
|
+
*/
|
|
40
|
+
LoginHint = "login_hint",
|
|
41
|
+
/**
|
|
42
|
+
* Specifies the identifier used in the identifier sign-in or identifier register page.
|
|
43
|
+
*
|
|
44
|
+
* This parameter is applicable only when first_screen is set to either `FirstScreen.IdentifierSignIn` or `FirstScreen.IdentifierRegister`.
|
|
45
|
+
* Multiple identifiers can be provided in the identifier parameter, separated by spaces.
|
|
46
|
+
*
|
|
47
|
+
* If the provided identifier is not supported in the Logto sign-in experience configuration, it will be ignored,
|
|
48
|
+
* and if no one of them is supported, it will fallback to the sign-in / sign-up method value set in the sign-in experience configuration.
|
|
49
|
+
*
|
|
50
|
+
* @see {@link SignInIdentifier} for available values.
|
|
51
|
+
*/
|
|
52
|
+
Identifier = "identifier"
|
|
36
53
|
}
|
|
37
54
|
/** @deprecated Use {@link FirstScreen} instead. */
|
|
38
55
|
export declare enum InteractionMode {
|
|
@@ -40,28 +57,42 @@ export declare enum InteractionMode {
|
|
|
40
57
|
SignUp = "signUp"
|
|
41
58
|
}
|
|
42
59
|
export declare enum FirstScreen {
|
|
43
|
-
SignIn = "
|
|
44
|
-
Register = "register"
|
|
60
|
+
SignIn = "sign_in",
|
|
61
|
+
Register = "register",
|
|
62
|
+
ResetPassword = "reset_password",
|
|
63
|
+
IdentifierSignIn = "identifier:sign_in",
|
|
64
|
+
IdentifierRegister = "identifier:register",
|
|
65
|
+
SingleSignOn = "single_sign_on",
|
|
66
|
+
/** @deprecated Use snake_case 'sign_in' instead. */
|
|
67
|
+
SignInDeprecated = "signIn"
|
|
45
68
|
}
|
|
46
69
|
export declare const extraParamsObjectGuard: z.ZodObject<{
|
|
47
70
|
interaction_mode: z.ZodOptional<z.ZodNativeEnum<typeof InteractionMode>>;
|
|
48
71
|
first_screen: z.ZodOptional<z.ZodNativeEnum<typeof FirstScreen>>;
|
|
49
72
|
direct_sign_in: z.ZodOptional<z.ZodString>;
|
|
50
73
|
organization_id: z.ZodOptional<z.ZodString>;
|
|
74
|
+
login_hint: z.ZodOptional<z.ZodString>;
|
|
75
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
51
76
|
}, "strip", z.ZodTypeAny, {
|
|
52
77
|
interaction_mode?: InteractionMode | undefined;
|
|
53
78
|
first_screen?: FirstScreen | undefined;
|
|
54
79
|
direct_sign_in?: string | undefined;
|
|
55
80
|
organization_id?: string | undefined;
|
|
81
|
+
login_hint?: string | undefined;
|
|
82
|
+
identifier?: string | undefined;
|
|
56
83
|
}, {
|
|
57
84
|
interaction_mode?: InteractionMode | undefined;
|
|
58
85
|
first_screen?: FirstScreen | undefined;
|
|
59
86
|
direct_sign_in?: string | undefined;
|
|
60
87
|
organization_id?: string | undefined;
|
|
88
|
+
login_hint?: string | undefined;
|
|
89
|
+
identifier?: string | undefined;
|
|
61
90
|
}>;
|
|
62
91
|
export type ExtraParamsObject = Partial<{
|
|
63
92
|
[ExtraParamsKey.InteractionMode]: InteractionMode;
|
|
64
93
|
[ExtraParamsKey.FirstScreen]: FirstScreen;
|
|
65
94
|
[ExtraParamsKey.DirectSignIn]: string;
|
|
66
95
|
[ExtraParamsKey.OrganizationId]: string;
|
|
96
|
+
[ExtraParamsKey.LoginHint]: string;
|
|
97
|
+
[ExtraParamsKey.Identifier]: string;
|
|
67
98
|
}>;
|