@idp.global/interfaces 9.3.0 → 10.0.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/changelog.md +9 -0
- package/dist_ts/00_commitinfo_data.js +2 -2
- package/dist_ts/data/activity.d.ts +3 -1
- package/dist_ts/data/app.d.ts +12 -5
- package/dist_ts/data/jwt.d.ts +5 -0
- package/dist_ts/data/oidc.d.ts +4 -92
- package/dist_ts/data/organization.d.ts +1 -0
- package/dist_ts/dto/app.d.ts +7 -1
- package/dist_ts/dto/organization.d.ts +1 -0
- package/dist_ts/request/admin.d.ts +34 -2
- package/dist_ts/request/jwt.d.ts +3 -0
- package/package.json +1 -1
- package/readme.md +7 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/data/activity.ts +18 -1
- package/ts/data/app.ts +13 -5
- package/ts/data/jwt.ts +6 -0
- package/ts/data/oidc.ts +4 -96
- package/ts/data/organization.ts +1 -0
- package/ts/dto/app.ts +7 -1
- package/ts/dto/organization.ts +1 -0
- package/ts/readme.md +9 -0
- package/ts/request/admin.ts +44 -2
- package/ts/request/jwt.ts +2 -0
package/changelog.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026-07-10 - 10.0.0
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
- revise OIDC, JWT, and organization contracts (contracts)
|
|
8
|
+
- Require expanded public OIDC app configuration, including client type, post-logout redirect URIs, grant types, token lifetimes, and safe secret metadata.
|
|
9
|
+
- Remove persisted OIDC secret and token storage records from public contracts while exposing JWT verification key sets for rotation.
|
|
10
|
+
- Add organization status and suspension contracts plus expanded activity outcome metadata.
|
|
11
|
+
|
|
3
12
|
## 2026-07-10 - 9.3.0
|
|
4
13
|
|
|
5
14
|
### Features
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@idp.global/interfaces',
|
|
6
|
-
version: '
|
|
6
|
+
version: '10.0.0',
|
|
7
7
|
description: 'Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.'
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLHVGQUF1RjtDQUNyRyxDQUFBIn0=
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type TActivityAction = 'login' | 'logout' | 'session_created' | 'session_revoked' | 'passport_device_enrolled' | 'passport_device_revoked' | 'passport_challenge_approved' | 'passport_challenge_rejected' | 'org_created' | 'org_updated' | 'org_deleted' | 'org_ownership_transferred' | 'org_joined' | 'org_left' | 'role_changed' | 'org_app_role_mappings_updated' | 'profile_updated' | 'totp_enabled' | 'totp_disabled' | 'backup_codes_regenerated' | 'mfa_completed' | 'passkey_registered' | 'passkey_revoked' | 'passkey_login' | 'app_connected' | 'app_disconnected' | 'user_suspended' | 'user_unsuspended' | 'account_deletion_requested' | 'account_deletion_cancelled' | 'account_purged' | 'sso_connection_created' | 'sso_connection_updated' | 'sso_connection_deleted' | 'sso_domain_verified' | 'sso_login' | 'scim_token_created' | 'scim_token_revoked' | 'scim_user_provisioned' | 'scim_user_updated' | 'scim_user_deactivated' | 'scim_group_membership_changed';
|
|
1
|
+
export type TActivityAction = 'login' | 'logout' | 'session_created' | 'session_revoked' | 'passport_device_enrolled' | 'passport_device_revoked' | 'passport_challenge_approved' | 'passport_challenge_rejected' | 'org_created' | 'org_updated' | 'org_deleted' | 'org_ownership_transferred' | 'org_joined' | 'org_left' | 'role_changed' | 'org_app_role_mappings_updated' | 'profile_updated' | 'totp_enabled' | 'totp_disabled' | 'backup_codes_regenerated' | 'mfa_completed' | 'passkey_registered' | 'passkey_revoked' | 'passkey_login' | 'app_connected' | 'app_disconnected' | 'user_suspended' | 'user_unsuspended' | 'account_deletion_requested' | 'account_deletion_cancelled' | 'account_purged' | 'sso_connection_created' | 'sso_connection_updated' | 'sso_connection_deleted' | 'sso_domain_verified' | 'sso_login' | 'scim_token_created' | 'scim_token_revoked' | 'scim_user_provisioned' | 'scim_user_updated' | 'scim_user_deactivated' | 'scim_group_membership_changed' | 'oidc_authorization_granted' | 'oidc_code_exchanged' | 'oidc_refresh_rotated' | 'oidc_refresh_reuse_detected' | 'oidc_token_revoked' | 'oidc_logout' | 'oidc_client_created' | 'oidc_client_updated' | 'oidc_client_activation_changed' | 'oidc_client_deleted' | 'oidc_client_secret_rotated' | 'oidc_signing_key_rotated' | 'oidc_lifecycle_revoked' | 'org_suspended' | 'org_unsuspended';
|
|
2
2
|
export interface IActivityLog {
|
|
3
3
|
id: string;
|
|
4
4
|
data: {
|
|
@@ -10,6 +10,8 @@ export interface IActivityLog {
|
|
|
10
10
|
userAgent?: string;
|
|
11
11
|
targetId?: string;
|
|
12
12
|
targetType?: string;
|
|
13
|
+
outcome?: 'pending' | 'success' | 'failure';
|
|
14
|
+
reason?: string;
|
|
13
15
|
description: string;
|
|
14
16
|
};
|
|
15
17
|
};
|
package/dist_ts/data/app.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
export type TAppType = 'global' | 'partner' | 'custom_oidc';
|
|
2
2
|
export type TAppApprovalStatus = 'draft' | 'pending_review' | 'approved' | 'rejected' | 'suspended';
|
|
3
|
+
export type TOAuthClientType = 'public' | 'confidential';
|
|
4
|
+
export interface IOidcSettings {
|
|
5
|
+
accessTokenLifetime: number;
|
|
6
|
+
idTokenLifetime: number;
|
|
7
|
+
refreshTokenLifetime: number;
|
|
8
|
+
}
|
|
3
9
|
export interface IOAuthCredentials {
|
|
4
10
|
clientId: string;
|
|
5
|
-
|
|
11
|
+
clientType: TOAuthClientType;
|
|
6
12
|
redirectUris: string[];
|
|
13
|
+
postLogoutRedirectUris: string[];
|
|
7
14
|
allowedScopes: string[];
|
|
8
15
|
grantTypes: ('authorization_code' | 'client_credentials' | 'refresh_token')[];
|
|
9
16
|
}
|
|
@@ -18,6 +25,7 @@ export interface IGlobalApp {
|
|
|
18
25
|
type: 'global';
|
|
19
26
|
data: IAppBaseData & {
|
|
20
27
|
oauthCredentials: IOAuthCredentials;
|
|
28
|
+
oidcSettings: IOidcSettings;
|
|
21
29
|
isActive: boolean;
|
|
22
30
|
category: string;
|
|
23
31
|
createdAt: number;
|
|
@@ -30,6 +38,7 @@ export interface IPartnerApp {
|
|
|
30
38
|
data: IAppBaseData & {
|
|
31
39
|
ownerOrganizationId: string;
|
|
32
40
|
oauthCredentials: IOAuthCredentials;
|
|
41
|
+
oidcSettings: IOidcSettings;
|
|
33
42
|
appStoreMetadata: {
|
|
34
43
|
shortDescription: string;
|
|
35
44
|
longDescription: string;
|
|
@@ -51,10 +60,8 @@ export interface ICustomOidcApp {
|
|
|
51
60
|
data: IAppBaseData & {
|
|
52
61
|
ownerOrganizationId: string;
|
|
53
62
|
oauthCredentials: IOAuthCredentials;
|
|
54
|
-
oidcSettings:
|
|
55
|
-
|
|
56
|
-
refreshTokenLifetime: number;
|
|
57
|
-
};
|
|
63
|
+
oidcSettings: IOidcSettings;
|
|
64
|
+
isActive: boolean;
|
|
58
65
|
};
|
|
59
66
|
}
|
|
60
67
|
export type IApp = IGlobalApp | IPartnerApp | ICustomOidcApp;
|
package/dist_ts/data/jwt.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export type TLoginStatus = 'loggedIn' | 'loggedOut' | 'invalidated' | 'not found' | 'transfer';
|
|
2
2
|
export type TLoginAction = 'login' | 'logout' | 'manage';
|
|
3
|
+
export interface IJwtVerificationKey {
|
|
4
|
+
kid: string;
|
|
5
|
+
publicKeyPem: string;
|
|
6
|
+
retireAt?: number;
|
|
7
|
+
}
|
|
3
8
|
export interface IJwt {
|
|
4
9
|
id: string;
|
|
5
10
|
blocked: boolean;
|
package/dist_ts/data/oidc.d.ts
CHANGED
|
@@ -5,98 +5,6 @@
|
|
|
5
5
|
* Supported OIDC scopes
|
|
6
6
|
*/
|
|
7
7
|
export type TOidcScope = 'openid' | 'profile' | 'email' | 'organizations' | 'roles';
|
|
8
|
-
/**
|
|
9
|
-
* Authorization code for OAuth 2.0 authorization code flow
|
|
10
|
-
*/
|
|
11
|
-
export interface IAuthorizationCode {
|
|
12
|
-
id: string;
|
|
13
|
-
data: {
|
|
14
|
-
/** Hashed authorization code string */
|
|
15
|
-
codeHash: string;
|
|
16
|
-
/** OAuth client ID */
|
|
17
|
-
clientId: string;
|
|
18
|
-
/** User ID who authorized */
|
|
19
|
-
userId: string;
|
|
20
|
-
/** Scopes granted */
|
|
21
|
-
scopes: TOidcScope[];
|
|
22
|
-
/** Redirect URI used in authorization request */
|
|
23
|
-
redirectUri: string;
|
|
24
|
-
/** PKCE code challenge (S256 hashed) */
|
|
25
|
-
codeChallenge: string;
|
|
26
|
-
/** PKCE code challenge method */
|
|
27
|
-
codeChallengeMethod: 'S256';
|
|
28
|
-
/** Nonce from authorization request (for ID token) */
|
|
29
|
-
nonce?: string;
|
|
30
|
-
/** Expiration timestamp (10 minutes from creation) */
|
|
31
|
-
expiresAt: number;
|
|
32
|
-
/** Creation timestamp */
|
|
33
|
-
issuedAt: number;
|
|
34
|
-
/** Whether the code has been used (single-use) */
|
|
35
|
-
used: boolean;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* OIDC Access Token (opaque or JWT)
|
|
40
|
-
*/
|
|
41
|
-
export interface IOidcAccessToken {
|
|
42
|
-
id: string;
|
|
43
|
-
data: {
|
|
44
|
-
/** The access token string hash for storage */
|
|
45
|
-
tokenHash: string;
|
|
46
|
-
/** OAuth client ID */
|
|
47
|
-
clientId: string;
|
|
48
|
-
/** User ID */
|
|
49
|
-
userId: string;
|
|
50
|
-
/** Granted scopes */
|
|
51
|
-
scopes: TOidcScope[];
|
|
52
|
-
/** Expiration timestamp */
|
|
53
|
-
expiresAt: number;
|
|
54
|
-
/** Creation timestamp */
|
|
55
|
-
issuedAt: number;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* OIDC Refresh Token
|
|
60
|
-
*/
|
|
61
|
-
export interface IOidcRefreshToken {
|
|
62
|
-
id: string;
|
|
63
|
-
data: {
|
|
64
|
-
/** The refresh token string hash for storage */
|
|
65
|
-
tokenHash: string;
|
|
66
|
-
/** OAuth client ID */
|
|
67
|
-
clientId: string;
|
|
68
|
-
/** User ID */
|
|
69
|
-
userId: string;
|
|
70
|
-
/** Granted scopes */
|
|
71
|
-
scopes: TOidcScope[];
|
|
72
|
-
/** Rotation family identifier for refresh token reuse detection */
|
|
73
|
-
familyId: string;
|
|
74
|
-
/** Expiration timestamp */
|
|
75
|
-
expiresAt: number;
|
|
76
|
-
/** Creation timestamp */
|
|
77
|
-
issuedAt: number;
|
|
78
|
-
/** Whether the token has been revoked */
|
|
79
|
-
revoked: boolean;
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* User consent record for an OAuth client
|
|
84
|
-
*/
|
|
85
|
-
export interface IUserConsent {
|
|
86
|
-
id: string;
|
|
87
|
-
data: {
|
|
88
|
-
/** User who gave consent */
|
|
89
|
-
userId: string;
|
|
90
|
-
/** OAuth client ID */
|
|
91
|
-
clientId: string;
|
|
92
|
-
/** Scopes the user consented to */
|
|
93
|
-
scopes: TOidcScope[];
|
|
94
|
-
/** When consent was granted */
|
|
95
|
-
grantedAt: number;
|
|
96
|
-
/** When consent was last updated */
|
|
97
|
-
updatedAt: number;
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
8
|
/**
|
|
101
9
|
* OIDC Discovery Document (OpenID Provider Configuration)
|
|
102
10
|
*/
|
|
@@ -107,12 +15,14 @@ export interface IOidcDiscoveryDocument {
|
|
|
107
15
|
userinfo_endpoint: string;
|
|
108
16
|
jwks_uri: string;
|
|
109
17
|
revocation_endpoint: string;
|
|
18
|
+
end_session_endpoint: string;
|
|
110
19
|
scopes_supported: TOidcScope[];
|
|
111
20
|
response_types_supported: string[];
|
|
112
21
|
grant_types_supported: string[];
|
|
113
22
|
subject_types_supported: string[];
|
|
114
23
|
id_token_signing_alg_values_supported: string[];
|
|
115
24
|
token_endpoint_auth_methods_supported: string[];
|
|
25
|
+
revocation_endpoint_auth_methods_supported: string[];
|
|
116
26
|
code_challenge_methods_supported: string[];
|
|
117
27
|
claims_supported: string[];
|
|
118
28
|
}
|
|
@@ -149,6 +59,8 @@ export interface IIdTokenClaims {
|
|
|
149
59
|
iat: number;
|
|
150
60
|
/** Authentication time (Unix timestamp) */
|
|
151
61
|
auth_time?: number;
|
|
62
|
+
/** OP login session identifier */
|
|
63
|
+
sid?: string;
|
|
152
64
|
/** Nonce (if provided in authorization request) */
|
|
153
65
|
nonce?: string;
|
|
154
66
|
/** Access token hash (for hybrid flows) */
|
package/dist_ts/dto/app.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { IAppRoleMapping } from '../data/role.js';
|
|
2
|
-
import type { TAppType } from '../data/app.js';
|
|
2
|
+
import type { IOidcSettings, TAppType, TOAuthClientType } from '../data/app.js';
|
|
3
3
|
export interface IOAuthClientDto {
|
|
4
4
|
clientId: string;
|
|
5
|
+
clientType: TOAuthClientType;
|
|
5
6
|
redirectUris: string[];
|
|
7
|
+
postLogoutRedirectUris: string[];
|
|
6
8
|
allowedScopes: string[];
|
|
7
9
|
grantTypes: ('authorization_code' | 'client_credentials' | 'refresh_token')[];
|
|
10
|
+
hasActiveClientSecret: boolean;
|
|
11
|
+
retiringClientSecretCount: number;
|
|
12
|
+
nextRetiringClientSecretExpiry?: number;
|
|
8
13
|
}
|
|
9
14
|
export interface IGlobalAppDto {
|
|
10
15
|
id: string;
|
|
@@ -15,6 +20,7 @@ export interface IGlobalAppDto {
|
|
|
15
20
|
logoUrl: string;
|
|
16
21
|
appUrl: string;
|
|
17
22
|
oauthCredentials: IOAuthClientDto;
|
|
23
|
+
oidcSettings: IOidcSettings;
|
|
18
24
|
isActive: boolean;
|
|
19
25
|
category: string;
|
|
20
26
|
createdAt: number;
|
|
@@ -39,12 +39,16 @@ export interface IReq_CreateGlobalApp extends plugins.typedRequestInterfaces.imp
|
|
|
39
39
|
logoUrl: string;
|
|
40
40
|
appUrl: string;
|
|
41
41
|
category: string;
|
|
42
|
+
clientType: dto.IGlobalAppDto['data']['oauthCredentials']['clientType'];
|
|
42
43
|
redirectUris: string[];
|
|
44
|
+
postLogoutRedirectUris: string[];
|
|
43
45
|
allowedScopes: string[];
|
|
46
|
+
grantTypes: dto.IGlobalAppDto['data']['oauthCredentials']['grantTypes'];
|
|
47
|
+
oidcSettings: dto.IGlobalAppDto['data']['oidcSettings'];
|
|
44
48
|
};
|
|
45
49
|
response: {
|
|
46
50
|
app: dto.IGlobalAppDto;
|
|
47
|
-
clientSecret
|
|
51
|
+
clientSecret?: string;
|
|
48
52
|
};
|
|
49
53
|
}
|
|
50
54
|
/**
|
|
@@ -62,8 +66,12 @@ export interface IReq_UpdateGlobalApp extends plugins.typedRequestInterfaces.imp
|
|
|
62
66
|
appUrl?: string;
|
|
63
67
|
category?: string;
|
|
64
68
|
isActive?: boolean;
|
|
69
|
+
clientType?: dto.IGlobalAppDto['data']['oauthCredentials']['clientType'];
|
|
65
70
|
redirectUris?: string[];
|
|
71
|
+
postLogoutRedirectUris?: string[];
|
|
66
72
|
allowedScopes?: string[];
|
|
73
|
+
grantTypes?: dto.IGlobalAppDto['data']['oauthCredentials']['grantTypes'];
|
|
74
|
+
oidcSettings?: dto.IGlobalAppDto['data']['oidcSettings'];
|
|
67
75
|
};
|
|
68
76
|
};
|
|
69
77
|
response: {
|
|
@@ -85,17 +93,40 @@ export interface IReq_DeleteGlobalApp extends plugins.typedRequestInterfaces.imp
|
|
|
85
93
|
};
|
|
86
94
|
}
|
|
87
95
|
/**
|
|
88
|
-
*
|
|
96
|
+
* Rotate the client secret for a global app while keeping its client ID stable.
|
|
89
97
|
*/
|
|
90
98
|
export interface IReq_RegenerateAppCredentials extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_RegenerateAppCredentials> {
|
|
91
99
|
method: 'regenerateAppCredentials';
|
|
92
100
|
request: {
|
|
93
101
|
jwt: string;
|
|
94
102
|
appId: string;
|
|
103
|
+
gracePeriodSeconds?: number;
|
|
95
104
|
};
|
|
96
105
|
response: {
|
|
97
106
|
clientId: string;
|
|
98
107
|
clientSecret: string;
|
|
108
|
+
retiringSecretsValidUntil?: number;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export interface IReq_RotateOidcSigningKey extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_RotateOidcSigningKey> {
|
|
112
|
+
method: 'rotateOidcSigningKey';
|
|
113
|
+
request: {
|
|
114
|
+
jwt: string;
|
|
115
|
+
};
|
|
116
|
+
response: {
|
|
117
|
+
activeKid: string;
|
|
118
|
+
retiringKids: string[];
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export interface IReq_SetOrganizationSuspension extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_SetOrganizationSuspension> {
|
|
122
|
+
method: 'setOrganizationSuspension';
|
|
123
|
+
request: {
|
|
124
|
+
jwt: string;
|
|
125
|
+
organizationId: string;
|
|
126
|
+
suspended: boolean;
|
|
127
|
+
};
|
|
128
|
+
response: {
|
|
129
|
+
organization: dto.IOrganizationDto;
|
|
99
130
|
};
|
|
100
131
|
}
|
|
101
132
|
/**
|
|
@@ -147,6 +178,7 @@ export interface IReq_GetGlobalOrgStats extends plugins.typedRequestInterfaces.i
|
|
|
147
178
|
id: string;
|
|
148
179
|
name: string;
|
|
149
180
|
slug: string;
|
|
181
|
+
status: dto.IOrganizationDto['data']['status'];
|
|
150
182
|
memberCount: number;
|
|
151
183
|
}>;
|
|
152
184
|
total: number;
|
package/dist_ts/request/jwt.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as data from '../data/index.js';
|
|
1
2
|
import * as plugins from '../plugins.js';
|
|
2
3
|
/**
|
|
3
4
|
* Request to get the public key for JWT validation.
|
|
@@ -16,6 +17,7 @@ export interface IReq_GetPublicKeyForValidation extends plugins.typedRequestInte
|
|
|
16
17
|
};
|
|
17
18
|
response: {
|
|
18
19
|
publicKeyPem: string;
|
|
20
|
+
publicKeys: data.IJwtVerificationKey[];
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
@@ -32,6 +34,7 @@ export interface IReq_PushPublicKeyForValidation extends plugins.typedRequestInt
|
|
|
32
34
|
method: 'pushPublicKeyForValidation';
|
|
33
35
|
request: {
|
|
34
36
|
publicKeyPem: string;
|
|
37
|
+
publicKeys: data.IJwtVerificationKey[];
|
|
35
38
|
};
|
|
36
39
|
response: {};
|
|
37
40
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -45,6 +45,7 @@ const organization: data.IOrganization = {
|
|
|
45
45
|
data: {
|
|
46
46
|
name: 'Acme',
|
|
47
47
|
slug: 'acme',
|
|
48
|
+
status: 'active',
|
|
48
49
|
billingPlanId: 'plan_free',
|
|
49
50
|
roleIds: [],
|
|
50
51
|
},
|
|
@@ -68,9 +69,14 @@ const payload: LoginRequest['request'] = {
|
|
|
68
69
|
|
|
69
70
|
Request groups cover login, registration, JWT refresh, user/session queries, organization membership, invitations, apps, billing, admin actions, alerts, passport device flows, password reset, device IDs, and OIDC authorization.
|
|
70
71
|
|
|
72
|
+
OIDC app contracts expose only client configuration and safe credential
|
|
73
|
+
metadata. Client-secret hashes, signing private keys, and persistence records
|
|
74
|
+
for authorization codes, access tokens, refresh tokens, and token families
|
|
75
|
+
remain backend-internal; protocol request and response values remain public.
|
|
76
|
+
|
|
71
77
|
## DTO Contracts
|
|
72
78
|
|
|
73
|
-
Use `dto` for normalized transfer objects grouped by activity, alerts, apps, billing, invitations, MFA, organizations, passport, and users.
|
|
79
|
+
Use `dto` for normalized transfer objects grouped by activity, alerts, apps, billing, invitations, MFA, organizations, passport, and users. Public OIDC support includes `data.IOidcSettings` and redacted `data.IJwtVerificationKey` records.
|
|
74
80
|
|
|
75
81
|
## Scope
|
|
76
82
|
|
package/ts/00_commitinfo_data.ts
CHANGED
package/ts/data/activity.ts
CHANGED
|
@@ -40,7 +40,22 @@ export type TActivityAction =
|
|
|
40
40
|
| 'scim_user_provisioned'
|
|
41
41
|
| 'scim_user_updated'
|
|
42
42
|
| 'scim_user_deactivated'
|
|
43
|
-
| 'scim_group_membership_changed'
|
|
43
|
+
| 'scim_group_membership_changed'
|
|
44
|
+
| 'oidc_authorization_granted'
|
|
45
|
+
| 'oidc_code_exchanged'
|
|
46
|
+
| 'oidc_refresh_rotated'
|
|
47
|
+
| 'oidc_refresh_reuse_detected'
|
|
48
|
+
| 'oidc_token_revoked'
|
|
49
|
+
| 'oidc_logout'
|
|
50
|
+
| 'oidc_client_created'
|
|
51
|
+
| 'oidc_client_updated'
|
|
52
|
+
| 'oidc_client_activation_changed'
|
|
53
|
+
| 'oidc_client_deleted'
|
|
54
|
+
| 'oidc_client_secret_rotated'
|
|
55
|
+
| 'oidc_signing_key_rotated'
|
|
56
|
+
| 'oidc_lifecycle_revoked'
|
|
57
|
+
| 'org_suspended'
|
|
58
|
+
| 'org_unsuspended';
|
|
44
59
|
|
|
45
60
|
export interface IActivityLog {
|
|
46
61
|
id: string;
|
|
@@ -53,6 +68,8 @@ export interface IActivityLog {
|
|
|
53
68
|
userAgent?: string;
|
|
54
69
|
targetId?: string;
|
|
55
70
|
targetType?: string;
|
|
71
|
+
outcome?: 'pending' | 'success' | 'failure';
|
|
72
|
+
reason?: string;
|
|
56
73
|
description: string;
|
|
57
74
|
};
|
|
58
75
|
};
|
package/ts/data/app.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
// App Types
|
|
2
2
|
export type TAppType = 'global' | 'partner' | 'custom_oidc';
|
|
3
3
|
export type TAppApprovalStatus = 'draft' | 'pending_review' | 'approved' | 'rejected' | 'suspended';
|
|
4
|
+
export type TOAuthClientType = 'public' | 'confidential';
|
|
5
|
+
|
|
6
|
+
export interface IOidcSettings {
|
|
7
|
+
accessTokenLifetime: number;
|
|
8
|
+
idTokenLifetime: number;
|
|
9
|
+
refreshTokenLifetime: number;
|
|
10
|
+
}
|
|
4
11
|
|
|
5
12
|
// OAuth Credentials
|
|
6
13
|
export interface IOAuthCredentials {
|
|
7
14
|
clientId: string;
|
|
8
|
-
|
|
15
|
+
clientType: TOAuthClientType;
|
|
9
16
|
redirectUris: string[];
|
|
17
|
+
postLogoutRedirectUris: string[];
|
|
10
18
|
allowedScopes: string[];
|
|
11
19
|
grantTypes: ('authorization_code' | 'client_credentials' | 'refresh_token')[];
|
|
12
20
|
}
|
|
@@ -25,6 +33,7 @@ export interface IGlobalApp {
|
|
|
25
33
|
type: 'global';
|
|
26
34
|
data: IAppBaseData & {
|
|
27
35
|
oauthCredentials: IOAuthCredentials;
|
|
36
|
+
oidcSettings: IOidcSettings;
|
|
28
37
|
isActive: boolean;
|
|
29
38
|
category: string;
|
|
30
39
|
createdAt: number;
|
|
@@ -39,6 +48,7 @@ export interface IPartnerApp {
|
|
|
39
48
|
data: IAppBaseData & {
|
|
40
49
|
ownerOrganizationId: string;
|
|
41
50
|
oauthCredentials: IOAuthCredentials;
|
|
51
|
+
oidcSettings: IOidcSettings;
|
|
42
52
|
appStoreMetadata: {
|
|
43
53
|
shortDescription: string;
|
|
44
54
|
longDescription: string;
|
|
@@ -60,10 +70,8 @@ export interface ICustomOidcApp {
|
|
|
60
70
|
data: IAppBaseData & {
|
|
61
71
|
ownerOrganizationId: string;
|
|
62
72
|
oauthCredentials: IOAuthCredentials;
|
|
63
|
-
oidcSettings:
|
|
64
|
-
|
|
65
|
-
refreshTokenLifetime: number; // seconds
|
|
66
|
-
};
|
|
73
|
+
oidcSettings: IOidcSettings;
|
|
74
|
+
isActive: boolean;
|
|
67
75
|
};
|
|
68
76
|
}
|
|
69
77
|
|
package/ts/data/jwt.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export type TLoginStatus = 'loggedIn' | 'loggedOut' | 'invalidated' | 'not found' | 'transfer';
|
|
2
2
|
export type TLoginAction = 'login' | 'logout' | 'manage';
|
|
3
3
|
|
|
4
|
+
export interface IJwtVerificationKey {
|
|
5
|
+
kid: string;
|
|
6
|
+
publicKeyPem: string;
|
|
7
|
+
retireAt?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
4
10
|
export interface IJwt {
|
|
5
11
|
id: string;
|
|
6
12
|
blocked: boolean;
|
package/ts/data/oidc.ts
CHANGED
|
@@ -7,102 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export type TOidcScope = 'openid' | 'profile' | 'email' | 'organizations' | 'roles';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Authorization code for OAuth 2.0 authorization code flow
|
|
12
|
-
*/
|
|
13
|
-
export interface IAuthorizationCode {
|
|
14
|
-
id: string;
|
|
15
|
-
data: {
|
|
16
|
-
/** Hashed authorization code string */
|
|
17
|
-
codeHash: string;
|
|
18
|
-
/** OAuth client ID */
|
|
19
|
-
clientId: string;
|
|
20
|
-
/** User ID who authorized */
|
|
21
|
-
userId: string;
|
|
22
|
-
/** Scopes granted */
|
|
23
|
-
scopes: TOidcScope[];
|
|
24
|
-
/** Redirect URI used in authorization request */
|
|
25
|
-
redirectUri: string;
|
|
26
|
-
/** PKCE code challenge (S256 hashed) */
|
|
27
|
-
codeChallenge: string;
|
|
28
|
-
/** PKCE code challenge method */
|
|
29
|
-
codeChallengeMethod: 'S256';
|
|
30
|
-
/** Nonce from authorization request (for ID token) */
|
|
31
|
-
nonce?: string;
|
|
32
|
-
/** Expiration timestamp (10 minutes from creation) */
|
|
33
|
-
expiresAt: number;
|
|
34
|
-
/** Creation timestamp */
|
|
35
|
-
issuedAt: number;
|
|
36
|
-
/** Whether the code has been used (single-use) */
|
|
37
|
-
used: boolean;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* OIDC Access Token (opaque or JWT)
|
|
43
|
-
*/
|
|
44
|
-
export interface IOidcAccessToken {
|
|
45
|
-
id: string;
|
|
46
|
-
data: {
|
|
47
|
-
/** The access token string hash for storage */
|
|
48
|
-
tokenHash: string;
|
|
49
|
-
/** OAuth client ID */
|
|
50
|
-
clientId: string;
|
|
51
|
-
/** User ID */
|
|
52
|
-
userId: string;
|
|
53
|
-
/** Granted scopes */
|
|
54
|
-
scopes: TOidcScope[];
|
|
55
|
-
/** Expiration timestamp */
|
|
56
|
-
expiresAt: number;
|
|
57
|
-
/** Creation timestamp */
|
|
58
|
-
issuedAt: number;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* OIDC Refresh Token
|
|
64
|
-
*/
|
|
65
|
-
export interface IOidcRefreshToken {
|
|
66
|
-
id: string;
|
|
67
|
-
data: {
|
|
68
|
-
/** The refresh token string hash for storage */
|
|
69
|
-
tokenHash: string;
|
|
70
|
-
/** OAuth client ID */
|
|
71
|
-
clientId: string;
|
|
72
|
-
/** User ID */
|
|
73
|
-
userId: string;
|
|
74
|
-
/** Granted scopes */
|
|
75
|
-
scopes: TOidcScope[];
|
|
76
|
-
/** Rotation family identifier for refresh token reuse detection */
|
|
77
|
-
familyId: string;
|
|
78
|
-
/** Expiration timestamp */
|
|
79
|
-
expiresAt: number;
|
|
80
|
-
/** Creation timestamp */
|
|
81
|
-
issuedAt: number;
|
|
82
|
-
/** Whether the token has been revoked */
|
|
83
|
-
revoked: boolean;
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* User consent record for an OAuth client
|
|
89
|
-
*/
|
|
90
|
-
export interface IUserConsent {
|
|
91
|
-
id: string;
|
|
92
|
-
data: {
|
|
93
|
-
/** User who gave consent */
|
|
94
|
-
userId: string;
|
|
95
|
-
/** OAuth client ID */
|
|
96
|
-
clientId: string;
|
|
97
|
-
/** Scopes the user consented to */
|
|
98
|
-
scopes: TOidcScope[];
|
|
99
|
-
/** When consent was granted */
|
|
100
|
-
grantedAt: number;
|
|
101
|
-
/** When consent was last updated */
|
|
102
|
-
updatedAt: number;
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
10
|
/**
|
|
107
11
|
* OIDC Discovery Document (OpenID Provider Configuration)
|
|
108
12
|
*/
|
|
@@ -113,12 +17,14 @@ export interface IOidcDiscoveryDocument {
|
|
|
113
17
|
userinfo_endpoint: string;
|
|
114
18
|
jwks_uri: string;
|
|
115
19
|
revocation_endpoint: string;
|
|
20
|
+
end_session_endpoint: string;
|
|
116
21
|
scopes_supported: TOidcScope[];
|
|
117
22
|
response_types_supported: string[];
|
|
118
23
|
grant_types_supported: string[];
|
|
119
24
|
subject_types_supported: string[];
|
|
120
25
|
id_token_signing_alg_values_supported: string[];
|
|
121
26
|
token_endpoint_auth_methods_supported: string[];
|
|
27
|
+
revocation_endpoint_auth_methods_supported: string[];
|
|
122
28
|
code_challenge_methods_supported: string[];
|
|
123
29
|
claims_supported: string[];
|
|
124
30
|
}
|
|
@@ -158,6 +64,8 @@ export interface IIdTokenClaims {
|
|
|
158
64
|
iat: number;
|
|
159
65
|
/** Authentication time (Unix timestamp) */
|
|
160
66
|
auth_time?: number;
|
|
67
|
+
/** OP login session identifier */
|
|
68
|
+
sid?: string;
|
|
161
69
|
/** Nonce (if provided in authorization request) */
|
|
162
70
|
nonce?: string;
|
|
163
71
|
/** Access token hash (for hybrid flows) */
|
package/ts/data/organization.ts
CHANGED
package/ts/dto/app.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { IAppRoleMapping } from '../data/role.js';
|
|
2
|
-
import type { TAppType } from '../data/app.js';
|
|
2
|
+
import type { IOidcSettings, TAppType, TOAuthClientType } from '../data/app.js';
|
|
3
3
|
|
|
4
4
|
export interface IOAuthClientDto {
|
|
5
5
|
clientId: string;
|
|
6
|
+
clientType: TOAuthClientType;
|
|
6
7
|
redirectUris: string[];
|
|
8
|
+
postLogoutRedirectUris: string[];
|
|
7
9
|
allowedScopes: string[];
|
|
8
10
|
grantTypes: ('authorization_code' | 'client_credentials' | 'refresh_token')[];
|
|
11
|
+
hasActiveClientSecret: boolean;
|
|
12
|
+
retiringClientSecretCount: number;
|
|
13
|
+
nextRetiringClientSecretExpiry?: number;
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
export interface IGlobalAppDto {
|
|
@@ -17,6 +22,7 @@ export interface IGlobalAppDto {
|
|
|
17
22
|
logoUrl: string;
|
|
18
23
|
appUrl: string;
|
|
19
24
|
oauthCredentials: IOAuthClientDto;
|
|
25
|
+
oidcSettings: IOidcSettings;
|
|
20
26
|
isActive: boolean;
|
|
21
27
|
category: string;
|
|
22
28
|
createdAt: number;
|
package/ts/dto/organization.ts
CHANGED
package/ts/readme.md
CHANGED
|
@@ -29,6 +29,7 @@ const organization: data.IOrganization = {
|
|
|
29
29
|
data: {
|
|
30
30
|
name: 'Acme',
|
|
31
31
|
slug: 'acme',
|
|
32
|
+
status: 'active',
|
|
32
33
|
billingPlanId: 'plan_free',
|
|
33
34
|
roleIds: [],
|
|
34
35
|
},
|
|
@@ -110,8 +111,16 @@ type TSessions = request.IReq_GetUserSessions['response']['sessions'];
|
|
|
110
111
|
|
|
111
112
|
```ts
|
|
112
113
|
type TUserInfo = data.IUserInfoResponse;
|
|
114
|
+
type TOidcSettings = data.IOidcSettings;
|
|
115
|
+
type TJwtVerificationKey = data.IJwtVerificationKey;
|
|
113
116
|
```
|
|
114
117
|
|
|
118
|
+
Public app contracts contain client type, callback and post-logout URIs,
|
|
119
|
+
allowed scopes, grant types, and bounded token lifetime settings. Secret hashes,
|
|
120
|
+
private signing keys, and persistence records for authorization codes, access
|
|
121
|
+
tokens, refresh tokens, and token families are backend-internal; protocol
|
|
122
|
+
values remain public contracts.
|
|
123
|
+
|
|
115
124
|
## Scope
|
|
116
125
|
|
|
117
126
|
This package is intentionally contract-only. It does not open sockets, store auth state, or perform HTTP/websocket communication by itself.
|
package/ts/request/admin.ts
CHANGED
|
@@ -54,12 +54,16 @@ export interface IReq_CreateGlobalApp
|
|
|
54
54
|
logoUrl: string;
|
|
55
55
|
appUrl: string;
|
|
56
56
|
category: string;
|
|
57
|
+
clientType: dto.IGlobalAppDto['data']['oauthCredentials']['clientType'];
|
|
57
58
|
redirectUris: string[];
|
|
59
|
+
postLogoutRedirectUris: string[];
|
|
58
60
|
allowedScopes: string[];
|
|
61
|
+
grantTypes: dto.IGlobalAppDto['data']['oauthCredentials']['grantTypes'];
|
|
62
|
+
oidcSettings: dto.IGlobalAppDto['data']['oidcSettings'];
|
|
59
63
|
};
|
|
60
64
|
response: {
|
|
61
65
|
app: dto.IGlobalAppDto;
|
|
62
|
-
clientSecret
|
|
66
|
+
clientSecret?: string; // Confidential clients only; shown once on creation
|
|
63
67
|
};
|
|
64
68
|
}
|
|
65
69
|
|
|
@@ -82,8 +86,12 @@ export interface IReq_UpdateGlobalApp
|
|
|
82
86
|
appUrl?: string;
|
|
83
87
|
category?: string;
|
|
84
88
|
isActive?: boolean;
|
|
89
|
+
clientType?: dto.IGlobalAppDto['data']['oauthCredentials']['clientType'];
|
|
85
90
|
redirectUris?: string[];
|
|
91
|
+
postLogoutRedirectUris?: string[];
|
|
86
92
|
allowedScopes?: string[];
|
|
93
|
+
grantTypes?: dto.IGlobalAppDto['data']['oauthCredentials']['grantTypes'];
|
|
94
|
+
oidcSettings?: dto.IGlobalAppDto['data']['oidcSettings'];
|
|
87
95
|
};
|
|
88
96
|
};
|
|
89
97
|
response: {
|
|
@@ -111,7 +119,7 @@ export interface IReq_DeleteGlobalApp
|
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
/**
|
|
114
|
-
*
|
|
122
|
+
* Rotate the client secret for a global app while keeping its client ID stable.
|
|
115
123
|
*/
|
|
116
124
|
export interface IReq_RegenerateAppCredentials
|
|
117
125
|
extends plugins.typedRequestInterfaces.implementsTR<
|
|
@@ -122,10 +130,43 @@ export interface IReq_RegenerateAppCredentials
|
|
|
122
130
|
request: {
|
|
123
131
|
jwt: string;
|
|
124
132
|
appId: string;
|
|
133
|
+
gracePeriodSeconds?: number;
|
|
125
134
|
};
|
|
126
135
|
response: {
|
|
127
136
|
clientId: string;
|
|
128
137
|
clientSecret: string; // Only shown once
|
|
138
|
+
retiringSecretsValidUntil?: number;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface IReq_RotateOidcSigningKey
|
|
143
|
+
extends plugins.typedRequestInterfaces.implementsTR<
|
|
144
|
+
plugins.typedRequestInterfaces.ITypedRequest,
|
|
145
|
+
IReq_RotateOidcSigningKey
|
|
146
|
+
> {
|
|
147
|
+
method: 'rotateOidcSigningKey';
|
|
148
|
+
request: {
|
|
149
|
+
jwt: string;
|
|
150
|
+
};
|
|
151
|
+
response: {
|
|
152
|
+
activeKid: string;
|
|
153
|
+
retiringKids: string[];
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface IReq_SetOrganizationSuspension
|
|
158
|
+
extends plugins.typedRequestInterfaces.implementsTR<
|
|
159
|
+
plugins.typedRequestInterfaces.ITypedRequest,
|
|
160
|
+
IReq_SetOrganizationSuspension
|
|
161
|
+
> {
|
|
162
|
+
method: 'setOrganizationSuspension';
|
|
163
|
+
request: {
|
|
164
|
+
jwt: string;
|
|
165
|
+
organizationId: string;
|
|
166
|
+
suspended: boolean;
|
|
167
|
+
};
|
|
168
|
+
response: {
|
|
169
|
+
organization: dto.IOrganizationDto;
|
|
129
170
|
};
|
|
130
171
|
}
|
|
131
172
|
|
|
@@ -192,6 +233,7 @@ export interface IReq_GetGlobalOrgStats
|
|
|
192
233
|
id: string;
|
|
193
234
|
name: string;
|
|
194
235
|
slug: string;
|
|
236
|
+
status: dto.IOrganizationDto['data']['status'];
|
|
195
237
|
memberCount: number;
|
|
196
238
|
}>;
|
|
197
239
|
total: number;
|
package/ts/request/jwt.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface IReq_GetPublicKeyForValidation
|
|
|
22
22
|
};
|
|
23
23
|
response: {
|
|
24
24
|
publicKeyPem: string;
|
|
25
|
+
publicKeys: data.IJwtVerificationKey[];
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -43,6 +44,7 @@ export interface IReq_PushPublicKeyForValidation
|
|
|
43
44
|
method: 'pushPublicKeyForValidation';
|
|
44
45
|
request: {
|
|
45
46
|
publicKeyPem: string;
|
|
47
|
+
publicKeys: data.IJwtVerificationKey[];
|
|
46
48
|
};
|
|
47
49
|
response: {};
|
|
48
50
|
}
|