@logto/schemas 1.43.0 → 1.44.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.44.0-1788946735-add-saml-authn-request-config.ts +18 -0
- package/alterations/1.44.0-1789000000-extend-user-id-length.ts +61 -0
- package/alterations-js/1.44.0-1788946735-add-saml-authn-request-config.js +14 -0
- package/alterations-js/1.44.0-1789000000-extend-user-id-length.js +47 -0
- package/lib/consts/experience.d.ts +3 -0
- package/lib/consts/experience.js +3 -0
- package/lib/consts/index.d.ts +1 -0
- package/lib/consts/index.js +1 -0
- package/lib/consts/license.d.ts +222 -0
- package/lib/consts/license.js +81 -0
- package/lib/consts/license.test.d.ts +1 -0
- package/lib/consts/license.test.js +96 -0
- package/lib/consts/oidc.d.ts +15 -1
- package/lib/consts/oidc.js +11 -0
- package/lib/consts/oidc.test.d.ts +1 -0
- package/lib/consts/oidc.test.js +15 -0
- package/lib/consts/subscriptions.d.ts +13 -1
- package/lib/consts/subscriptions.js +12 -0
- package/lib/db-entries/aggregated-daily-active-user.js +2 -2
- package/lib/db-entries/application-access-control-user-relation.js +2 -2
- package/lib/db-entries/application-user-consent-organization.js +2 -2
- package/lib/db-entries/cimd-grant-organization.js +2 -2
- package/lib/db-entries/daily-active-user.js +2 -2
- package/lib/db-entries/oidc-session-extension.js +2 -2
- package/lib/db-entries/organization-invitation.js +4 -4
- package/lib/db-entries/organization-role-user-relation.js +2 -2
- package/lib/db-entries/organization-user-relation.js +2 -2
- package/lib/db-entries/personal-access-token.js +2 -2
- package/lib/db-entries/saml-application-config.d.ts +4 -2
- package/lib/db-entries/saml-application-config.js +5 -1
- package/lib/db-entries/secret.js +2 -2
- package/lib/db-entries/subject-token.js +2 -2
- package/lib/db-entries/trusted-device.js +2 -2
- package/lib/db-entries/user-geo-location.js +2 -2
- package/lib/db-entries/user-sign-in-country.js +2 -2
- package/lib/db-entries/user-sso-identity.js +2 -2
- package/lib/db-entries/user.js +2 -2
- package/lib/db-entries/users-role.js +2 -2
- package/lib/db-entries/verification-record.js +2 -2
- package/lib/db-entries/verification-status.js +2 -2
- package/lib/foundations/jsonb-types/captcha.d.ts +47 -1
- package/lib/foundations/jsonb-types/captcha.js +20 -0
- package/lib/foundations/jsonb-types/hooks.d.ts +0 -3
- package/lib/foundations/jsonb-types/hooks.js +2 -6
- package/lib/foundations/jsonb-types/saml-application-configs.d.ts +23 -0
- package/lib/foundations/jsonb-types/saml-application-configs.js +16 -0
- package/lib/foundations/jsonb-types/saml-application-configs.test.js +24 -1
- package/lib/types/authentication-context.d.ts +224 -0
- package/lib/types/authentication-context.js +238 -0
- package/lib/types/authentication-context.test.d.ts +1 -0
- package/lib/types/authentication-context.test.js +186 -0
- package/lib/types/cookie.d.ts +4 -0
- package/lib/types/cookie.js +6 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/interactions.d.ts +161 -0
- package/lib/types/interactions.js +23 -0
- package/lib/types/log/interaction.d.ts +15 -2
- package/lib/types/log/interaction.js +5 -0
- package/lib/types/logto-config/index.d.ts +47 -0
- package/lib/types/logto-config/index.js +1 -0
- package/lib/types/logto-config/jwt-customizer.d.ts +92 -0
- package/lib/types/saml-application.d.ts +55 -1
- package/lib/types/saml-application.js +7 -1
- package/lib/types/sign-in-experience.d.ts +11 -7
- package/lib/types/sign-in-experience.js +2 -2
- package/lib/types/ssr.d.ts +2 -0
- package/lib/types/system.d.ts +57 -5
- package/lib/types/system.js +36 -0
- package/lib/types/system.test.d.ts +1 -0
- package/lib/types/system.test.js +26 -0
- package/lib/types/user-sessions.d.ts +156 -0
- package/lib/types/verification-records/code-verification.d.ts +17 -0
- package/lib/types/verification-records/code-verification.js +1 -0
- package/lib/utils/oidc-private-key.test.js +44 -0
- package/package.json +7 -7
- package/tables/aggregated_daily_active_users.sql +1 -1
- package/tables/application_access_control_user_relations.sql +1 -1
- package/tables/application_user_consent_organizations.sql +1 -1
- package/tables/cimd_grant_organizations.sql +1 -1
- package/tables/daily_active_users.sql +1 -1
- package/tables/oidc_session_extensions.sql +1 -1
- package/tables/organization_invitations.sql +2 -2
- package/tables/organization_role_user_relations.sql +1 -1
- package/tables/organization_user_relations.sql +1 -1
- package/tables/personal_access_tokens.sql +1 -1
- package/tables/saml_application_configs.sql +1 -0
- package/tables/secrets.sql +1 -1
- package/tables/subject_tokens.sql +1 -1
- package/tables/trusted_devices.sql +1 -1
- package/tables/user_geo_locations.sql +1 -1
- package/tables/user_sign_in_countries.sql +1 -1
- package/tables/user_sso_identities.sql +1 -1
- package/tables/users.sql +1 -1
- package/tables/users_roles.sql +1 -1
- package/tables/verification_records.sql +1 -1
- package/tables/verification_statuses.sql +1 -1
- package/LICENSE +0 -373
|
@@ -17,11 +17,17 @@ export type CodeVerificationRecordData<T extends CodeVerificationType = CodeVeri
|
|
|
17
17
|
identifier: VerificationCodeIdentifierOf<T>;
|
|
18
18
|
templateType: TemplateType;
|
|
19
19
|
verified: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The user the identifier was resolved from, when the record was created for the subject the
|
|
22
|
+
* interaction carries rather than from a client-supplied identifier.
|
|
23
|
+
*/
|
|
24
|
+
userId?: string;
|
|
20
25
|
};
|
|
21
26
|
export declare const emailCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
22
27
|
id: z.ZodString;
|
|
23
28
|
templateType: z.ZodNativeEnum<typeof TemplateType>;
|
|
24
29
|
verified: z.ZodBoolean;
|
|
30
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
25
31
|
} & {
|
|
26
32
|
type: z.ZodLiteral<VerificationType.EmailVerificationCode>;
|
|
27
33
|
identifier: z.ZodObject<{
|
|
@@ -43,6 +49,7 @@ export declare const emailCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
|
43
49
|
};
|
|
44
50
|
templateType: TemplateType;
|
|
45
51
|
verified: boolean;
|
|
52
|
+
userId?: string | undefined;
|
|
46
53
|
}, {
|
|
47
54
|
type: VerificationType.EmailVerificationCode;
|
|
48
55
|
id: string;
|
|
@@ -52,11 +59,13 @@ export declare const emailCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
|
52
59
|
};
|
|
53
60
|
templateType: TemplateType;
|
|
54
61
|
verified: boolean;
|
|
62
|
+
userId?: string | undefined;
|
|
55
63
|
}>;
|
|
56
64
|
export declare const phoneCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
57
65
|
id: z.ZodString;
|
|
58
66
|
templateType: z.ZodNativeEnum<typeof TemplateType>;
|
|
59
67
|
verified: z.ZodBoolean;
|
|
68
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
60
69
|
} & {
|
|
61
70
|
type: z.ZodLiteral<VerificationType.PhoneVerificationCode>;
|
|
62
71
|
identifier: z.ZodObject<{
|
|
@@ -78,6 +87,7 @@ export declare const phoneCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
|
78
87
|
};
|
|
79
88
|
templateType: TemplateType;
|
|
80
89
|
verified: boolean;
|
|
90
|
+
userId?: string | undefined;
|
|
81
91
|
}, {
|
|
82
92
|
type: VerificationType.PhoneVerificationCode;
|
|
83
93
|
id: string;
|
|
@@ -87,11 +97,13 @@ export declare const phoneCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
|
87
97
|
};
|
|
88
98
|
templateType: TemplateType;
|
|
89
99
|
verified: boolean;
|
|
100
|
+
userId?: string | undefined;
|
|
90
101
|
}>;
|
|
91
102
|
export declare const mfaEmailCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
92
103
|
id: z.ZodString;
|
|
93
104
|
templateType: z.ZodNativeEnum<typeof TemplateType>;
|
|
94
105
|
verified: z.ZodBoolean;
|
|
106
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
95
107
|
} & {
|
|
96
108
|
type: z.ZodLiteral<VerificationType.MfaEmailVerificationCode>;
|
|
97
109
|
identifier: z.ZodObject<{
|
|
@@ -113,6 +125,7 @@ export declare const mfaEmailCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
|
113
125
|
};
|
|
114
126
|
templateType: TemplateType;
|
|
115
127
|
verified: boolean;
|
|
128
|
+
userId?: string | undefined;
|
|
116
129
|
}, {
|
|
117
130
|
type: VerificationType.MfaEmailVerificationCode;
|
|
118
131
|
id: string;
|
|
@@ -122,11 +135,13 @@ export declare const mfaEmailCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
|
122
135
|
};
|
|
123
136
|
templateType: TemplateType;
|
|
124
137
|
verified: boolean;
|
|
138
|
+
userId?: string | undefined;
|
|
125
139
|
}>;
|
|
126
140
|
export declare const mfaPhoneCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
127
141
|
id: z.ZodString;
|
|
128
142
|
templateType: z.ZodNativeEnum<typeof TemplateType>;
|
|
129
143
|
verified: z.ZodBoolean;
|
|
144
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
130
145
|
} & {
|
|
131
146
|
type: z.ZodLiteral<VerificationType.MfaPhoneVerificationCode>;
|
|
132
147
|
identifier: z.ZodObject<{
|
|
@@ -148,6 +163,7 @@ export declare const mfaPhoneCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
|
148
163
|
};
|
|
149
164
|
templateType: TemplateType;
|
|
150
165
|
verified: boolean;
|
|
166
|
+
userId?: string | undefined;
|
|
151
167
|
}, {
|
|
152
168
|
type: VerificationType.MfaPhoneVerificationCode;
|
|
153
169
|
id: string;
|
|
@@ -157,5 +173,6 @@ export declare const mfaPhoneCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
|
157
173
|
};
|
|
158
174
|
templateType: TemplateType;
|
|
159
175
|
verified: boolean;
|
|
176
|
+
userId?: string | undefined;
|
|
160
177
|
}>;
|
|
161
178
|
export {};
|
|
@@ -5,6 +5,7 @@ const basicCodeVerificationRecordDataGuard = z.object({
|
|
|
5
5
|
id: z.string(),
|
|
6
6
|
templateType: z.nativeEnum(TemplateType),
|
|
7
7
|
verified: z.boolean(),
|
|
8
|
+
userId: z.string().optional(),
|
|
8
9
|
});
|
|
9
10
|
export const emailCodeVerificationRecordDataGuard = basicCodeVerificationRecordDataGuard.extend({
|
|
10
11
|
type: z.literal(VerificationType.EmailVerificationCode),
|
|
@@ -14,6 +14,17 @@ describe('OIDC private key helpers', () => {
|
|
|
14
14
|
createPrivateKey('previous', 2, OidcSigningKeyStatus.Previous),
|
|
15
15
|
]);
|
|
16
16
|
});
|
|
17
|
+
it('preserves explicit statuses without reordering the input array', () => {
|
|
18
|
+
expect(normalizeOidcPrivateKeys([
|
|
19
|
+
createPrivateKey('previous', 3, OidcSigningKeyStatus.Previous),
|
|
20
|
+
createPrivateKey('current', 2, OidcSigningKeyStatus.Current),
|
|
21
|
+
createPrivateKey('next', 1, OidcSigningKeyStatus.Next),
|
|
22
|
+
])).toEqual([
|
|
23
|
+
createPrivateKey('previous', 3, OidcSigningKeyStatus.Previous),
|
|
24
|
+
createPrivateKey('current', 2, OidcSigningKeyStatus.Current),
|
|
25
|
+
createPrivateKey('next', 1, OidcSigningKeyStatus.Next),
|
|
26
|
+
]);
|
|
27
|
+
});
|
|
17
28
|
it('throws for malformed status configurations', () => {
|
|
18
29
|
expect(() => normalizeOidcPrivateKeys([
|
|
19
30
|
createPrivateKey('current-a', 1, OidcSigningKeyStatus.Current),
|
|
@@ -81,6 +92,17 @@ describe('OIDC private key helpers', () => {
|
|
|
81
92
|
createPrivateKey('previous', 1, OidcSigningKeyStatus.Previous),
|
|
82
93
|
]);
|
|
83
94
|
});
|
|
95
|
+
it('replaces any existing Next key instead of accumulating a fourth private key', () => {
|
|
96
|
+
expect(getStagedRotatedOidcPrivateKeys([
|
|
97
|
+
createPrivateKey('next', 4, OidcSigningKeyStatus.Next),
|
|
98
|
+
createPrivateKey('current', 3, OidcSigningKeyStatus.Current),
|
|
99
|
+
createPrivateKey('previous', 2, OidcSigningKeyStatus.Previous),
|
|
100
|
+
], createPrivateKey('replacement', 5))).toEqual([
|
|
101
|
+
createPrivateKey('replacement', 5, OidcSigningKeyStatus.Next),
|
|
102
|
+
createPrivateKey('current', 3, OidcSigningKeyStatus.Current),
|
|
103
|
+
createPrivateKey('previous', 2, OidcSigningKeyStatus.Previous),
|
|
104
|
+
]);
|
|
105
|
+
});
|
|
84
106
|
it('promotes Next to Current during activation', () => {
|
|
85
107
|
expect(rotateOidcPrivateKeyStatuses([
|
|
86
108
|
createPrivateKey('next', 3, OidcSigningKeyStatus.Next),
|
|
@@ -91,6 +113,28 @@ describe('OIDC private key helpers', () => {
|
|
|
91
113
|
createPrivateKey('current', 2, OidcSigningKeyStatus.Previous),
|
|
92
114
|
]);
|
|
93
115
|
});
|
|
116
|
+
it('returns the original keys when explicit-status keys have no staged Next key', () => {
|
|
117
|
+
const privateKeys = [
|
|
118
|
+
createPrivateKey('current', 2, OidcSigningKeyStatus.Current),
|
|
119
|
+
createPrivateKey('previous', 1, OidcSigningKeyStatus.Previous),
|
|
120
|
+
];
|
|
121
|
+
expect(rotateOidcPrivateKeyStatuses(privateKeys)).toBe(privateKeys);
|
|
122
|
+
});
|
|
123
|
+
it('returns normalized keys when legacy keys have no staged Next key', () => {
|
|
124
|
+
const privateKeys = [createPrivateKey('current', 2), createPrivateKey('previous', 1)];
|
|
125
|
+
const result = rotateOidcPrivateKeyStatuses(privateKeys);
|
|
126
|
+
expect(result).not.toBe(privateKeys);
|
|
127
|
+
expect(result).toEqual([
|
|
128
|
+
createPrivateKey('current', 2, OidcSigningKeyStatus.Current),
|
|
129
|
+
createPrivateKey('previous', 1, OidcSigningKeyStatus.Previous),
|
|
130
|
+
]);
|
|
131
|
+
});
|
|
132
|
+
it('keeps only Current when deleting Previous from a two-key set', () => {
|
|
133
|
+
expect(getOidcPrivateKeysAfterDeletion([
|
|
134
|
+
createPrivateKey('current', 2, OidcSigningKeyStatus.Current),
|
|
135
|
+
createPrivateKey('previous', 1, OidcSigningKeyStatus.Previous),
|
|
136
|
+
], 'previous')).toEqual([createPrivateKey('current', 2, OidcSigningKeyStatus.Current)]);
|
|
137
|
+
});
|
|
94
138
|
it('preserves status order when deleting Previous', () => {
|
|
95
139
|
expect(getOidcPrivateKeysAfterDeletion([
|
|
96
140
|
createPrivateKey('next', 3, OidcSigningKeyStatus.Next),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/schemas",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.0",
|
|
4
4
|
"author": "Silverhand Inc. <contact@silverhand.io>",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@types/inquirer": "^9.0.0",
|
|
32
32
|
"@types/node": "^22.14.0",
|
|
33
33
|
"@types/pluralize": "^0.0.33",
|
|
34
|
-
"@vitest/coverage-v8": "^4.1.
|
|
34
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
35
35
|
"camelcase": "^8.0.0",
|
|
36
36
|
"chalk": "^5.3.0",
|
|
37
37
|
"eslint": "^8.56.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"prettier": "^3.5.3",
|
|
41
41
|
"roarr": "^7.11.0",
|
|
42
42
|
"typescript": "^5.5.3",
|
|
43
|
-
"vitest": "^4.1.
|
|
43
|
+
"vitest": "^4.1.11"
|
|
44
44
|
},
|
|
45
45
|
"eslintConfig": {
|
|
46
46
|
"extends": "@silverhand",
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@withtyped/server": "^0.14.0",
|
|
67
67
|
"nanoid": "^5.0.9",
|
|
68
|
-
"@logto/
|
|
69
|
-
"@logto/
|
|
68
|
+
"@logto/connector-kit": "^5.1.2",
|
|
69
|
+
"@logto/phrases": "^1.32.0",
|
|
70
70
|
"@logto/language-kit": "^1.4.0",
|
|
71
|
-
"@logto/phrases": "^1.31.0",
|
|
72
71
|
"@logto/phrases-experience": "^1.15.0",
|
|
73
|
-
"@logto/shared": "^3.4.3"
|
|
72
|
+
"@logto/shared": "^3.4.3",
|
|
73
|
+
"@logto/core-kit": "^2.13.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"zod": "3.24.3"
|
|
@@ -6,7 +6,7 @@ create table application_access_control_user_relations (
|
|
|
6
6
|
references tenants (id) on update cascade on delete cascade,
|
|
7
7
|
application_id varchar(21) not null
|
|
8
8
|
references applications (id) on update cascade on delete cascade,
|
|
9
|
-
user_id varchar(
|
|
9
|
+
user_id varchar(128) not null
|
|
10
10
|
references users (id) on update cascade on delete cascade,
|
|
11
11
|
primary key (tenant_id, application_id, user_id)
|
|
12
12
|
);
|
|
@@ -7,7 +7,7 @@ create table application_user_consent_organizations (
|
|
|
7
7
|
application_id varchar(21) not null
|
|
8
8
|
references applications (id) on update cascade on delete cascade,
|
|
9
9
|
organization_id varchar(21) not null,
|
|
10
|
-
user_id varchar(
|
|
10
|
+
user_id varchar(128) not null,
|
|
11
11
|
primary key (tenant_id, application_id, organization_id, user_id),
|
|
12
12
|
/** User's consent to an application should be synchronized with the user's membership in the organization. */
|
|
13
13
|
foreign key (tenant_id, organization_id, user_id)
|
|
@@ -15,7 +15,7 @@ create table cimd_grant_organizations (
|
|
|
15
15
|
grant_model_name varchar(64) not null default 'Grant',
|
|
16
16
|
organization_id varchar(21) not null,
|
|
17
17
|
/** The user the grant was issued to and the membership FK's target. Must match the Grant payload's `accountId` (unreachable by FK) — the consent write enforces the pairing. */
|
|
18
|
-
user_id varchar(
|
|
18
|
+
user_id varchar(128) not null,
|
|
19
19
|
primary key (tenant_id, grant_id),
|
|
20
20
|
constraint cimd_grant_organizations__grant_model_name
|
|
21
21
|
check (grant_model_name = 'Grant'),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
create table daily_active_users (
|
|
2
2
|
id varchar(21) not null,
|
|
3
3
|
tenant_id varchar(21) not null,
|
|
4
|
-
user_id varchar(
|
|
4
|
+
user_id varchar(128) not null,
|
|
5
5
|
date timestamptz not null default (now()),
|
|
6
6
|
primary key (id),
|
|
7
7
|
constraint daily_active_users__user_id_date
|
|
@@ -4,7 +4,7 @@ create table oidc_session_extensions (
|
|
|
4
4
|
tenant_id varchar(21) not null
|
|
5
5
|
references tenants (id) on update cascade on delete cascade,
|
|
6
6
|
session_uid varchar(128) not null,
|
|
7
|
-
account_id varchar(
|
|
7
|
+
account_id varchar(128) not null
|
|
8
8
|
references users (id) on update cascade on delete cascade,
|
|
9
9
|
last_submission jsonb /* @use JsonObject */ not null default '{}'::jsonb,
|
|
10
10
|
client_id varchar(21) null,
|
|
@@ -9,12 +9,12 @@ create table organization_invitations (
|
|
|
9
9
|
/** The unique identifier of the invitation. */
|
|
10
10
|
id varchar(21) not null,
|
|
11
11
|
/** The user ID who sent the invitation. */
|
|
12
|
-
inviter_id varchar(
|
|
12
|
+
inviter_id varchar(128)
|
|
13
13
|
references users (id) on update cascade on delete cascade,
|
|
14
14
|
/** The email address or other identifier of the invitee. */
|
|
15
15
|
invitee varchar(256) not null,
|
|
16
16
|
/** The user ID of who accepted the invitation. */
|
|
17
|
-
accepted_user_id varchar(
|
|
17
|
+
accepted_user_id varchar(128)
|
|
18
18
|
references users (id) on update cascade on delete cascade,
|
|
19
19
|
/** The ID of the organization to which the invitee is invited. */
|
|
20
20
|
organization_id varchar(21) not null
|
|
@@ -7,7 +7,7 @@ create table organization_role_user_relations (
|
|
|
7
7
|
organization_id varchar(21) not null,
|
|
8
8
|
organization_role_id varchar(21) not null
|
|
9
9
|
references organization_roles (id) on update cascade on delete cascade,
|
|
10
|
-
user_id varchar(
|
|
10
|
+
user_id varchar(128) not null,
|
|
11
11
|
primary key (tenant_id, organization_id, organization_role_id, user_id),
|
|
12
12
|
/** User's roles in an organization should be synchronized with the user's membership in the organization. */
|
|
13
13
|
foreign key (tenant_id, organization_id, user_id)
|
|
@@ -6,7 +6,7 @@ create table organization_user_relations (
|
|
|
6
6
|
references tenants (id) on update cascade on delete cascade,
|
|
7
7
|
organization_id varchar(21) not null
|
|
8
8
|
references organizations (id) on update cascade on delete cascade,
|
|
9
|
-
user_id varchar(
|
|
9
|
+
user_id varchar(128) not null
|
|
10
10
|
references users (id) on update cascade on delete cascade,
|
|
11
11
|
primary key (tenant_id, organization_id, user_id),
|
|
12
12
|
constraint organization_user_relations__user_id__fk
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
create table personal_access_tokens (
|
|
4
4
|
tenant_id varchar(21) not null
|
|
5
5
|
references tenants (id) on update cascade on delete cascade,
|
|
6
|
-
user_id varchar(
|
|
6
|
+
user_id varchar(128) not null
|
|
7
7
|
references users (id) on update cascade on delete cascade,
|
|
8
8
|
/** The name of the secret. Should be unique within the user. */
|
|
9
9
|
name varchar(256) not null,
|
|
@@ -10,6 +10,7 @@ create table saml_application_configs (
|
|
|
10
10
|
entity_id varchar(128),
|
|
11
11
|
acs_url jsonb /* @use SamlAcsUrl */,
|
|
12
12
|
encryption jsonb /* @use SamlEncryption */,
|
|
13
|
+
authn_request_config jsonb /* @use SamlAuthnRequestConfig */,
|
|
13
14
|
name_id_format varchar(128) /* @use NameIdFormat */ not null,
|
|
14
15
|
primary key (tenant_id, application_id),
|
|
15
16
|
constraint saml_application_configs__application_type
|
package/tables/secrets.sql
CHANGED
|
@@ -3,7 +3,7 @@ create table secrets (
|
|
|
3
3
|
tenant_id varchar(21) not null
|
|
4
4
|
references tenants (id) on update cascade on delete cascade,
|
|
5
5
|
id varchar(21) not null primary key,
|
|
6
|
-
user_id varchar(
|
|
6
|
+
user_id varchar(128) not null
|
|
7
7
|
references users (id) on update cascade on delete cascade,
|
|
8
8
|
type varchar(256) /* @use SecretType */ not null,
|
|
9
9
|
/** Encrypted data encryption key (DEK) for the secret. */
|
|
@@ -5,7 +5,7 @@ create table subject_tokens (
|
|
|
5
5
|
context jsonb /* @use JsonObject */ not null default '{}'::jsonb,
|
|
6
6
|
expires_at timestamptz not null,
|
|
7
7
|
consumed_at timestamptz,
|
|
8
|
-
user_id varchar(
|
|
8
|
+
user_id varchar(128) not null
|
|
9
9
|
references users (id) on update cascade on delete cascade,
|
|
10
10
|
created_at timestamptz not null default(now()),
|
|
11
11
|
/* It is intented to not reference to user or application table, it can be userId or applicationId, for audit only */
|
|
@@ -5,7 +5,7 @@ create table trusted_devices (
|
|
|
5
5
|
tenant_id varchar(21) not null
|
|
6
6
|
references tenants (id) on update cascade on delete cascade,
|
|
7
7
|
id varchar(21) not null,
|
|
8
|
-
user_id varchar(
|
|
8
|
+
user_id varchar(128) not null
|
|
9
9
|
references users (id) on update cascade on delete cascade,
|
|
10
10
|
secret_hash bytea /* @use BufferLike */ not null,
|
|
11
11
|
user_agent text,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
create table user_geo_locations (
|
|
5
5
|
tenant_id varchar(21) not null
|
|
6
6
|
references tenants (id) on update cascade on delete cascade,
|
|
7
|
-
user_id varchar(
|
|
7
|
+
user_id varchar(128) not null
|
|
8
8
|
references users (id) on update cascade on delete cascade,
|
|
9
9
|
latitude numeric(9,6),
|
|
10
10
|
longitude numeric(9,6),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
create table user_sign_in_countries (
|
|
5
5
|
tenant_id varchar(21) not null
|
|
6
6
|
references tenants (id) on update cascade on delete cascade,
|
|
7
|
-
user_id varchar(
|
|
7
|
+
user_id varchar(128) not null
|
|
8
8
|
references users (id) on update cascade on delete cascade,
|
|
9
9
|
/** ISO 3166-1 alpha-2 country code (2 chars), stored up to 16 chars for robustness. */
|
|
10
10
|
country varchar(16) not null,
|
|
@@ -4,7 +4,7 @@ create table user_sso_identities (
|
|
|
4
4
|
tenant_id varchar(21) not null
|
|
5
5
|
references tenants (id) on update cascade on delete cascade,
|
|
6
6
|
id varchar(21) not null,
|
|
7
|
-
user_id varchar(
|
|
7
|
+
user_id varchar(128) not null references users (id) on update cascade on delete cascade,
|
|
8
8
|
/** Unique provider identifier. Issuer of the OIDC connectors, entityId of the SAML providers */
|
|
9
9
|
issuer varchar(256) not null,
|
|
10
10
|
/** Provider user identity id*/
|
package/tables/users.sql
CHANGED
|
@@ -5,7 +5,7 @@ create type users_password_encryption_method as enum ('Argon2i', 'Argon2id', 'Ar
|
|
|
5
5
|
create table users (
|
|
6
6
|
tenant_id varchar(21) not null
|
|
7
7
|
references tenants (id) on update cascade on delete cascade,
|
|
8
|
-
id varchar(
|
|
8
|
+
id varchar(128) not null,
|
|
9
9
|
username varchar(128),
|
|
10
10
|
primary_email varchar(128),
|
|
11
11
|
primary_phone varchar(128),
|
package/tables/users_roles.sql
CHANGED
|
@@ -4,7 +4,7 @@ create table users_roles (
|
|
|
4
4
|
tenant_id varchar(21) not null
|
|
5
5
|
references tenants (id) on update cascade on delete cascade,
|
|
6
6
|
id varchar(21) not null,
|
|
7
|
-
user_id varchar(
|
|
7
|
+
user_id varchar(128) not null
|
|
8
8
|
references users (id) on update cascade on delete cascade,
|
|
9
9
|
role_id varchar(21) not null
|
|
10
10
|
references roles (id) on update cascade on delete cascade,
|
|
@@ -2,7 +2,7 @@ create table verification_records (
|
|
|
2
2
|
tenant_id varchar(21) not null
|
|
3
3
|
references tenants (id) on update cascade on delete cascade,
|
|
4
4
|
id varchar(21) not null,
|
|
5
|
-
user_id varchar(
|
|
5
|
+
user_id varchar(128)
|
|
6
6
|
references users (id) on update cascade on delete cascade,
|
|
7
7
|
created_at timestamptz not null default(now()),
|
|
8
8
|
expires_at timestamptz not null,
|
|
@@ -2,7 +2,7 @@ create table verification_statuses (
|
|
|
2
2
|
tenant_id varchar(21) not null
|
|
3
3
|
references tenants (id) on update cascade on delete cascade,
|
|
4
4
|
id varchar(21) not null,
|
|
5
|
-
user_id varchar(
|
|
5
|
+
user_id varchar(128) not null
|
|
6
6
|
references users (id) on update cascade on delete cascade,
|
|
7
7
|
created_at timestamptz not null default(now()),
|
|
8
8
|
verified_identifier varchar(255),
|