@absolutejs/auth 0.29.0-beta.1 → 0.29.0-beta.3
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/dist/compliance/routes.d.ts +2 -2
- package/dist/credentials/emailVerification.d.ts +1 -1
- package/dist/credentials/login.d.ts +4 -4
- package/dist/credentials/passwordReset.d.ts +3 -3
- package/dist/credentials/routes.d.ts +8 -8
- package/dist/htmx/routes.d.ts +12 -12
- package/dist/index.d.ts +211 -87
- package/dist/index.js +604 -11
- package/dist/index.js.map +10 -8
- package/dist/mfa/challenge.d.ts +1 -1
- package/dist/mfa/routes.d.ts +4 -4
- package/dist/mfa/totp.d.ts +3 -3
- package/dist/oidc/clientAuth.d.ts +8 -0
- package/dist/oidc/config.d.ts +6 -1
- package/dist/oidc/inMemoryStores.d.ts +4 -1
- package/dist/oidc/postgresStores.d.ts +214 -1
- package/dist/oidc/registration.d.ts +131 -0
- package/dist/oidc/routes.d.ts +122 -0
- package/dist/oidc/types.d.ts +21 -0
- package/dist/organizations/routes.d.ts +16 -16
- package/dist/passwordless/routes.d.ts +4 -4
- package/dist/portal/routes.d.ts +10 -10
- package/dist/providers/clients.d.ts +2 -2
- package/dist/roles/routes.d.ts +5 -5
- package/dist/routes/authorize.d.ts +2 -2
- package/dist/routes/profile.d.ts +1 -1
- package/dist/routes/refresh.d.ts +2 -2
- package/dist/routes/revoke.d.ts +2 -2
- package/dist/routes/sessions.d.ts +6 -6
- package/dist/routes/signout.d.ts +1 -1
- package/dist/routes/userStatus.d.ts +1 -1
- package/dist/sso/discoveryRoute.d.ts +1 -1
- package/dist/sso/oidcRoutes.d.ts +2 -2
- package/dist/sso/samlRoutes.d.ts +5 -5
- package/dist/webauthn/routes.d.ts +5 -5
- package/package.json +1 -1
package/dist/mfa/challenge.d.ts
CHANGED
|
@@ -28,10 +28,10 @@ export declare const mfaChallenge: <UserType>({ authSessionStore, challengeRoute
|
|
|
28
28
|
query: unknown;
|
|
29
29
|
headers: unknown;
|
|
30
30
|
response: {
|
|
31
|
+
401: "No MFA challenge in progress" | "Invalid MFA code";
|
|
31
32
|
200: {
|
|
32
33
|
readonly status: "authenticated";
|
|
33
34
|
};
|
|
34
|
-
401: "No MFA challenge in progress" | "Invalid MFA code";
|
|
35
35
|
422: {
|
|
36
36
|
type: "validation";
|
|
37
37
|
on: string;
|
package/dist/mfa/routes.d.ts
CHANGED
|
@@ -26,11 +26,11 @@ export declare const mfaRoutes: <UserType>(config: MfaRouteProps<UserType>) => E
|
|
|
26
26
|
query: unknown;
|
|
27
27
|
headers: unknown;
|
|
28
28
|
response: {
|
|
29
|
+
401: "Authentication required";
|
|
29
30
|
200: {
|
|
30
31
|
readonly secret: string;
|
|
31
32
|
readonly uri: string;
|
|
32
33
|
};
|
|
33
|
-
401: "Authentication required";
|
|
34
34
|
422: {
|
|
35
35
|
type: "validation";
|
|
36
36
|
on: string;
|
|
@@ -53,11 +53,11 @@ export declare const mfaRoutes: <UserType>(config: MfaRouteProps<UserType>) => E
|
|
|
53
53
|
query: unknown;
|
|
54
54
|
headers: unknown;
|
|
55
55
|
response: {
|
|
56
|
+
400: "No TOTP enrollment in progress" | "Invalid TOTP code";
|
|
57
|
+
401: "Authentication required";
|
|
56
58
|
200: {
|
|
57
59
|
readonly backupCodes: string[];
|
|
58
60
|
};
|
|
59
|
-
400: "No TOTP enrollment in progress" | "Invalid TOTP code";
|
|
60
|
-
401: "Authentication required";
|
|
61
61
|
422: {
|
|
62
62
|
type: "validation";
|
|
63
63
|
on: string;
|
|
@@ -80,10 +80,10 @@ export declare const mfaRoutes: <UserType>(config: MfaRouteProps<UserType>) => E
|
|
|
80
80
|
query: unknown;
|
|
81
81
|
headers: unknown;
|
|
82
82
|
response: {
|
|
83
|
+
401: "No MFA challenge in progress" | "Invalid MFA code";
|
|
83
84
|
200: {
|
|
84
85
|
readonly status: "authenticated";
|
|
85
86
|
};
|
|
86
|
-
401: "No MFA challenge in progress" | "Invalid MFA code";
|
|
87
87
|
422: {
|
|
88
88
|
type: "validation";
|
|
89
89
|
on: string;
|
package/dist/mfa/totp.d.ts
CHANGED
|
@@ -26,11 +26,11 @@ export declare const mfaTotpRoutes: <UserType>({ authSessionStore, backupCodeCou
|
|
|
26
26
|
query: unknown;
|
|
27
27
|
headers: unknown;
|
|
28
28
|
response: {
|
|
29
|
+
401: "Authentication required";
|
|
29
30
|
200: {
|
|
30
31
|
readonly secret: string;
|
|
31
32
|
readonly uri: string;
|
|
32
33
|
};
|
|
33
|
-
401: "Authentication required";
|
|
34
34
|
422: {
|
|
35
35
|
type: "validation";
|
|
36
36
|
on: string;
|
|
@@ -53,11 +53,11 @@ export declare const mfaTotpRoutes: <UserType>({ authSessionStore, backupCodeCou
|
|
|
53
53
|
query: unknown;
|
|
54
54
|
headers: unknown;
|
|
55
55
|
response: {
|
|
56
|
+
400: "No TOTP enrollment in progress" | "Invalid TOTP code";
|
|
57
|
+
401: "Authentication required";
|
|
56
58
|
200: {
|
|
57
59
|
readonly backupCodes: string[];
|
|
58
60
|
};
|
|
59
|
-
400: "No TOTP enrollment in progress" | "Invalid TOTP code";
|
|
60
|
-
401: "Authentication required";
|
|
61
61
|
422: {
|
|
62
62
|
type: "validation";
|
|
63
63
|
on: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ClientAssertionJtiStore, OAuthClient } from './types';
|
|
2
|
+
export declare const CLIENT_ASSERTION_TYPE = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer";
|
|
3
|
+
export declare const verifyClientAssertion: ({ assertion, expectedAudience, jtiStore, resolveClient }: {
|
|
4
|
+
assertion: string;
|
|
5
|
+
expectedAudience: string;
|
|
6
|
+
jtiStore?: ClientAssertionJtiStore;
|
|
7
|
+
resolveClient: (clientId: string) => Promise<OAuthClient | undefined>;
|
|
8
|
+
}) => Promise<OAuthClient | undefined>;
|
package/dist/oidc/config.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { RouteString } from '../types';
|
|
2
2
|
import { type SigningKey } from './keys';
|
|
3
|
-
import type {
|
|
3
|
+
import type { OnClientRegistration } from './registration';
|
|
4
|
+
import type { AuthorizationCodeStore, ClientAssertionJtiStore, ClientRegistrationTokenStore, DeviceAuthorizationStore, InitialAccessTokenStore, LogoutDeliveryStore, OAuthClientStore, OidcRefreshTokenStore } from './types';
|
|
4
5
|
export declare const DEFAULT_OIDC_ROUTE: RouteString;
|
|
5
6
|
export type OidcProviderConfig<UserType> = {
|
|
6
7
|
accessTokenTtlMs?: number;
|
|
7
8
|
authorizationCodeStore: AuthorizationCodeStore;
|
|
9
|
+
clientAssertionJtiStore?: ClientAssertionJtiStore;
|
|
10
|
+
clientRegistrationTokenStore?: ClientRegistrationTokenStore;
|
|
8
11
|
clientStore: OAuthClientStore;
|
|
9
12
|
deviceAuthorizationStore?: DeviceAuthorizationStore;
|
|
10
13
|
deviceCodeTtlMs?: number;
|
|
@@ -27,9 +30,11 @@ export type OidcProviderConfig<UserType> = {
|
|
|
27
30
|
getUserId: (user: UserType) => string;
|
|
28
31
|
idTokenTtlMs?: number;
|
|
29
32
|
issuer: string;
|
|
33
|
+
initialAccessTokenStore?: InitialAccessTokenStore;
|
|
30
34
|
loginUrl?: string;
|
|
31
35
|
logoutDeliveryStore?: LogoutDeliveryStore;
|
|
32
36
|
oidcRoute?: RouteString;
|
|
37
|
+
onClientRegistration?: OnClientRegistration;
|
|
33
38
|
refreshTokenStore: OidcRefreshTokenStore;
|
|
34
39
|
refreshTokenTtlMs?: number;
|
|
35
40
|
signingKey: SigningKey;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { AuthorizationCodeStore, DeviceAuthorizationStore, LogoutDeliveryStore, OAuthClient, OAuthClientStore, OidcRefreshTokenStore } from './types';
|
|
1
|
+
import type { AuthorizationCodeStore, ClientAssertionJtiStore, ClientRegistrationTokenStore, DeviceAuthorizationStore, InitialAccessTokenStore, LogoutDeliveryStore, OAuthClient, OAuthClientStore, OidcRefreshTokenStore } from './types';
|
|
2
2
|
export declare const createInMemoryAuthorizationCodeStore: () => AuthorizationCodeStore;
|
|
3
|
+
export declare const createInMemoryClientAssertionJtiStore: () => ClientAssertionJtiStore;
|
|
3
4
|
export declare const createInMemoryDeviceAuthorizationStore: () => DeviceAuthorizationStore;
|
|
4
5
|
export declare const createInMemoryLogoutDeliveryStore: () => LogoutDeliveryStore;
|
|
6
|
+
export declare const createInMemoryClientRegistrationTokenStore: () => ClientRegistrationTokenStore;
|
|
7
|
+
export declare const createInMemoryInitialAccessTokenStore: (initialHashes?: string[]) => InitialAccessTokenStore;
|
|
5
8
|
export declare const createInMemoryOAuthClientStore: (clients: OAuthClient[]) => OAuthClientStore;
|
|
6
9
|
export declare const createInMemoryOidcRefreshTokenStore: () => OidcRefreshTokenStore;
|
|
@@ -1,5 +1,148 @@
|
|
|
1
1
|
import { type AnyPgDatabase } from '../stores/postgres';
|
|
2
|
-
import type { AuthorizationCodeStore, DeviceAuthorizationStore, LogoutDeliveryStore, OAuthClientStore, OidcRefreshTokenStore } from './types';
|
|
2
|
+
import type { AuthorizationCodeStore, ClientAssertionJtiStore, ClientRegistrationTokenStore, DeviceAuthorizationStore, InitialAccessTokenStore, LogoutDeliveryStore, OAuthClientStore, OidcRefreshTokenStore } from './types';
|
|
3
|
+
export declare const oauthClientAssertionJtisTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
|
+
name: "auth_oauth_client_assertion_jtis";
|
|
5
|
+
schema: undefined;
|
|
6
|
+
columns: {
|
|
7
|
+
client_id: import("drizzle-orm/pg-core").PgColumn<{
|
|
8
|
+
name: "client_id";
|
|
9
|
+
tableName: "auth_oauth_client_assertion_jtis";
|
|
10
|
+
dataType: "string";
|
|
11
|
+
columnType: "PgVarchar";
|
|
12
|
+
data: string;
|
|
13
|
+
driverParam: string;
|
|
14
|
+
notNull: true;
|
|
15
|
+
hasDefault: false;
|
|
16
|
+
isPrimaryKey: false;
|
|
17
|
+
isAutoincrement: false;
|
|
18
|
+
hasRuntimeDefault: false;
|
|
19
|
+
enumValues: [string, ...string[]];
|
|
20
|
+
baseColumn: never;
|
|
21
|
+
identity: undefined;
|
|
22
|
+
generated: undefined;
|
|
23
|
+
}, {}, {
|
|
24
|
+
length: 255;
|
|
25
|
+
}>;
|
|
26
|
+
composite_key: import("drizzle-orm/pg-core").PgColumn<{
|
|
27
|
+
name: "composite_key";
|
|
28
|
+
tableName: "auth_oauth_client_assertion_jtis";
|
|
29
|
+
dataType: "string";
|
|
30
|
+
columnType: "PgVarchar";
|
|
31
|
+
data: string;
|
|
32
|
+
driverParam: string;
|
|
33
|
+
notNull: true;
|
|
34
|
+
hasDefault: false;
|
|
35
|
+
isPrimaryKey: true;
|
|
36
|
+
isAutoincrement: false;
|
|
37
|
+
hasRuntimeDefault: false;
|
|
38
|
+
enumValues: [string, ...string[]];
|
|
39
|
+
baseColumn: never;
|
|
40
|
+
identity: undefined;
|
|
41
|
+
generated: undefined;
|
|
42
|
+
}, {}, {
|
|
43
|
+
length: 255;
|
|
44
|
+
}>;
|
|
45
|
+
expires_at_ms: import("drizzle-orm/pg-core").PgColumn<{
|
|
46
|
+
name: "expires_at_ms";
|
|
47
|
+
tableName: "auth_oauth_client_assertion_jtis";
|
|
48
|
+
dataType: "number";
|
|
49
|
+
columnType: "PgBigInt53";
|
|
50
|
+
data: number;
|
|
51
|
+
driverParam: string | number;
|
|
52
|
+
notNull: true;
|
|
53
|
+
hasDefault: false;
|
|
54
|
+
isPrimaryKey: false;
|
|
55
|
+
isAutoincrement: false;
|
|
56
|
+
hasRuntimeDefault: false;
|
|
57
|
+
enumValues: undefined;
|
|
58
|
+
baseColumn: never;
|
|
59
|
+
identity: undefined;
|
|
60
|
+
generated: undefined;
|
|
61
|
+
}, {}, {}>;
|
|
62
|
+
jti: import("drizzle-orm/pg-core").PgColumn<{
|
|
63
|
+
name: "jti";
|
|
64
|
+
tableName: "auth_oauth_client_assertion_jtis";
|
|
65
|
+
dataType: "string";
|
|
66
|
+
columnType: "PgVarchar";
|
|
67
|
+
data: string;
|
|
68
|
+
driverParam: string;
|
|
69
|
+
notNull: true;
|
|
70
|
+
hasDefault: false;
|
|
71
|
+
isPrimaryKey: false;
|
|
72
|
+
isAutoincrement: false;
|
|
73
|
+
hasRuntimeDefault: false;
|
|
74
|
+
enumValues: [string, ...string[]];
|
|
75
|
+
baseColumn: never;
|
|
76
|
+
identity: undefined;
|
|
77
|
+
generated: undefined;
|
|
78
|
+
}, {}, {
|
|
79
|
+
length: 255;
|
|
80
|
+
}>;
|
|
81
|
+
};
|
|
82
|
+
dialect: "pg";
|
|
83
|
+
}>;
|
|
84
|
+
export declare const oauthClientRegistrationTokensTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
85
|
+
name: "auth_oauth_client_registration_tokens";
|
|
86
|
+
schema: undefined;
|
|
87
|
+
columns: {
|
|
88
|
+
client_id: import("drizzle-orm/pg-core").PgColumn<{
|
|
89
|
+
name: "client_id";
|
|
90
|
+
tableName: "auth_oauth_client_registration_tokens";
|
|
91
|
+
dataType: "string";
|
|
92
|
+
columnType: "PgVarchar";
|
|
93
|
+
data: string;
|
|
94
|
+
driverParam: string;
|
|
95
|
+
notNull: true;
|
|
96
|
+
hasDefault: false;
|
|
97
|
+
isPrimaryKey: false;
|
|
98
|
+
isAutoincrement: false;
|
|
99
|
+
hasRuntimeDefault: false;
|
|
100
|
+
enumValues: [string, ...string[]];
|
|
101
|
+
baseColumn: never;
|
|
102
|
+
identity: undefined;
|
|
103
|
+
generated: undefined;
|
|
104
|
+
}, {}, {
|
|
105
|
+
length: 255;
|
|
106
|
+
}>;
|
|
107
|
+
created_at_ms: import("drizzle-orm/pg-core").PgColumn<{
|
|
108
|
+
name: "created_at_ms";
|
|
109
|
+
tableName: "auth_oauth_client_registration_tokens";
|
|
110
|
+
dataType: "number";
|
|
111
|
+
columnType: "PgBigInt53";
|
|
112
|
+
data: number;
|
|
113
|
+
driverParam: string | number;
|
|
114
|
+
notNull: true;
|
|
115
|
+
hasDefault: false;
|
|
116
|
+
isPrimaryKey: false;
|
|
117
|
+
isAutoincrement: false;
|
|
118
|
+
hasRuntimeDefault: false;
|
|
119
|
+
enumValues: undefined;
|
|
120
|
+
baseColumn: never;
|
|
121
|
+
identity: undefined;
|
|
122
|
+
generated: undefined;
|
|
123
|
+
}, {}, {}>;
|
|
124
|
+
token_hash: import("drizzle-orm/pg-core").PgColumn<{
|
|
125
|
+
name: "token_hash";
|
|
126
|
+
tableName: "auth_oauth_client_registration_tokens";
|
|
127
|
+
dataType: "string";
|
|
128
|
+
columnType: "PgVarchar";
|
|
129
|
+
data: string;
|
|
130
|
+
driverParam: string;
|
|
131
|
+
notNull: true;
|
|
132
|
+
hasDefault: false;
|
|
133
|
+
isPrimaryKey: true;
|
|
134
|
+
isAutoincrement: false;
|
|
135
|
+
hasRuntimeDefault: false;
|
|
136
|
+
enumValues: [string, ...string[]];
|
|
137
|
+
baseColumn: never;
|
|
138
|
+
identity: undefined;
|
|
139
|
+
generated: undefined;
|
|
140
|
+
}, {}, {
|
|
141
|
+
length: 255;
|
|
142
|
+
}>;
|
|
143
|
+
};
|
|
144
|
+
dialect: "pg";
|
|
145
|
+
}>;
|
|
3
146
|
export declare const oauthClientsTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
147
|
name: "auth_oauth_clients";
|
|
5
148
|
schema: undefined;
|
|
@@ -61,6 +204,44 @@ export declare const oauthClientsTable: import("drizzle-orm/pg-core").PgTableWit
|
|
|
61
204
|
}, {}, {
|
|
62
205
|
length: 255;
|
|
63
206
|
}>;
|
|
207
|
+
jwks_json: import("drizzle-orm/pg-core").PgColumn<{
|
|
208
|
+
name: "jwks_json";
|
|
209
|
+
tableName: "auth_oauth_clients";
|
|
210
|
+
dataType: "json";
|
|
211
|
+
columnType: "PgJsonb";
|
|
212
|
+
data: JsonWebKey[];
|
|
213
|
+
driverParam: unknown;
|
|
214
|
+
notNull: false;
|
|
215
|
+
hasDefault: false;
|
|
216
|
+
isPrimaryKey: false;
|
|
217
|
+
isAutoincrement: false;
|
|
218
|
+
hasRuntimeDefault: false;
|
|
219
|
+
enumValues: undefined;
|
|
220
|
+
baseColumn: never;
|
|
221
|
+
identity: undefined;
|
|
222
|
+
generated: undefined;
|
|
223
|
+
}, {}, {
|
|
224
|
+
$type: JsonWebKey[];
|
|
225
|
+
}>;
|
|
226
|
+
jwks_uri: import("drizzle-orm/pg-core").PgColumn<{
|
|
227
|
+
name: "jwks_uri";
|
|
228
|
+
tableName: "auth_oauth_clients";
|
|
229
|
+
dataType: "string";
|
|
230
|
+
columnType: "PgVarchar";
|
|
231
|
+
data: string;
|
|
232
|
+
driverParam: string;
|
|
233
|
+
notNull: false;
|
|
234
|
+
hasDefault: false;
|
|
235
|
+
isPrimaryKey: false;
|
|
236
|
+
isAutoincrement: false;
|
|
237
|
+
hasRuntimeDefault: false;
|
|
238
|
+
enumValues: [string, ...string[]];
|
|
239
|
+
baseColumn: never;
|
|
240
|
+
identity: undefined;
|
|
241
|
+
generated: undefined;
|
|
242
|
+
}, {}, {
|
|
243
|
+
length: 2048;
|
|
244
|
+
}>;
|
|
64
245
|
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
65
246
|
name: "name";
|
|
66
247
|
tableName: "auth_oauth_clients";
|
|
@@ -644,6 +825,32 @@ export declare const oauthDeviceAuthorizationsTable: import("drizzle-orm/pg-core
|
|
|
644
825
|
};
|
|
645
826
|
dialect: "pg";
|
|
646
827
|
}>;
|
|
828
|
+
export declare const oauthInitialAccessTokensTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
829
|
+
name: "auth_oauth_initial_access_tokens";
|
|
830
|
+
schema: undefined;
|
|
831
|
+
columns: {
|
|
832
|
+
token_hash: import("drizzle-orm/pg-core").PgColumn<{
|
|
833
|
+
name: "token_hash";
|
|
834
|
+
tableName: "auth_oauth_initial_access_tokens";
|
|
835
|
+
dataType: "string";
|
|
836
|
+
columnType: "PgVarchar";
|
|
837
|
+
data: string;
|
|
838
|
+
driverParam: string;
|
|
839
|
+
notNull: true;
|
|
840
|
+
hasDefault: false;
|
|
841
|
+
isPrimaryKey: true;
|
|
842
|
+
isAutoincrement: false;
|
|
843
|
+
hasRuntimeDefault: false;
|
|
844
|
+
enumValues: [string, ...string[]];
|
|
845
|
+
baseColumn: never;
|
|
846
|
+
identity: undefined;
|
|
847
|
+
generated: undefined;
|
|
848
|
+
}, {}, {
|
|
849
|
+
length: 255;
|
|
850
|
+
}>;
|
|
851
|
+
};
|
|
852
|
+
dialect: "pg";
|
|
853
|
+
}>;
|
|
647
854
|
export declare const oauthLogoutDeliveriesTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
648
855
|
name: "auth_oauth_logout_deliveries";
|
|
649
856
|
schema: undefined;
|
|
@@ -992,12 +1199,18 @@ export declare const oauthRefreshTokensTable: import("drizzle-orm/pg-core").PgTa
|
|
|
992
1199
|
dialect: "pg";
|
|
993
1200
|
}>;
|
|
994
1201
|
export declare const createNeonAuthorizationCodeStore: (databaseUrl: string) => AuthorizationCodeStore;
|
|
1202
|
+
export declare const createNeonClientAssertionJtiStore: (databaseUrl: string) => ClientAssertionJtiStore;
|
|
1203
|
+
export declare const createNeonClientRegistrationTokenStore: (databaseUrl: string) => ClientRegistrationTokenStore;
|
|
995
1204
|
export declare const createNeonDeviceAuthorizationStore: (databaseUrl: string) => DeviceAuthorizationStore;
|
|
1205
|
+
export declare const createNeonInitialAccessTokenStore: (databaseUrl: string) => InitialAccessTokenStore;
|
|
996
1206
|
export declare const createNeonLogoutDeliveryStore: (databaseUrl: string) => LogoutDeliveryStore;
|
|
997
1207
|
export declare const createNeonOAuthClientStore: (databaseUrl: string) => OAuthClientStore;
|
|
998
1208
|
export declare const createNeonOidcRefreshTokenStore: (databaseUrl: string) => OidcRefreshTokenStore;
|
|
999
1209
|
export declare const createPostgresAuthorizationCodeStore: (db: AnyPgDatabase) => AuthorizationCodeStore;
|
|
1210
|
+
export declare const createPostgresClientAssertionJtiStore: (db: AnyPgDatabase) => ClientAssertionJtiStore;
|
|
1211
|
+
export declare const createPostgresClientRegistrationTokenStore: (db: AnyPgDatabase) => ClientRegistrationTokenStore;
|
|
1000
1212
|
export declare const createPostgresDeviceAuthorizationStore: (db: AnyPgDatabase) => DeviceAuthorizationStore;
|
|
1213
|
+
export declare const createPostgresInitialAccessTokenStore: (db: AnyPgDatabase) => InitialAccessTokenStore;
|
|
1001
1214
|
export declare const createPostgresLogoutDeliveryStore: (db: AnyPgDatabase) => LogoutDeliveryStore;
|
|
1002
1215
|
export declare const createPostgresOAuthClientStore: (db: AnyPgDatabase) => OAuthClientStore;
|
|
1003
1216
|
export declare const createPostgresOidcRefreshTokenStore: (db: AnyPgDatabase) => OidcRefreshTokenStore;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { ClientRegistrationTokenStore, InitialAccessTokenStore, OAuthClient, OAuthClientStore } from './types';
|
|
2
|
+
export type ClientRegistrationMetadata = {
|
|
3
|
+
backchannel_logout_uri?: string;
|
|
4
|
+
client_name?: string;
|
|
5
|
+
jwks?: JsonWebKey[];
|
|
6
|
+
jwks_uri?: string;
|
|
7
|
+
post_logout_redirect_uris?: string[];
|
|
8
|
+
redirect_uris?: string[];
|
|
9
|
+
scope?: string;
|
|
10
|
+
};
|
|
11
|
+
export type ClientRegistrationDecision = {
|
|
12
|
+
allow: false;
|
|
13
|
+
denyReason: string;
|
|
14
|
+
} | {
|
|
15
|
+
allow: true;
|
|
16
|
+
transform?: Partial<OAuthClient>;
|
|
17
|
+
};
|
|
18
|
+
export type OnClientRegistration = (context: {
|
|
19
|
+
metadata: ClientRegistrationMetadata;
|
|
20
|
+
}) => ClientRegistrationDecision | Promise<ClientRegistrationDecision>;
|
|
21
|
+
export type RegisterClientResult = {
|
|
22
|
+
body: {
|
|
23
|
+
error: string;
|
|
24
|
+
error_description?: string;
|
|
25
|
+
};
|
|
26
|
+
ok: false;
|
|
27
|
+
status: 400 | 401 | 403 | 501;
|
|
28
|
+
} | {
|
|
29
|
+
body: ClientRegistrationMetadata & {
|
|
30
|
+
client_id: string;
|
|
31
|
+
registration_access_token: string;
|
|
32
|
+
registration_client_uri: string;
|
|
33
|
+
};
|
|
34
|
+
ok: true;
|
|
35
|
+
};
|
|
36
|
+
export declare const deleteRegisteredClient: ({ authorization, clientId, clientStore, registrationTokenStore }: {
|
|
37
|
+
authorization: string | undefined;
|
|
38
|
+
clientId: string;
|
|
39
|
+
clientStore: OAuthClientStore;
|
|
40
|
+
registrationTokenStore: ClientRegistrationTokenStore;
|
|
41
|
+
}) => Promise<{
|
|
42
|
+
readonly body: {
|
|
43
|
+
readonly error: "unsupported_response_type";
|
|
44
|
+
};
|
|
45
|
+
readonly status: 501;
|
|
46
|
+
} | {
|
|
47
|
+
readonly body: {
|
|
48
|
+
readonly error: "invalid_token";
|
|
49
|
+
};
|
|
50
|
+
readonly status: 401;
|
|
51
|
+
} | {
|
|
52
|
+
readonly status: 204;
|
|
53
|
+
readonly body?: undefined;
|
|
54
|
+
}>;
|
|
55
|
+
export declare const getRegisteredClient: ({ authorization, clientId, clientStore, registrationTokenStore }: {
|
|
56
|
+
authorization: string | undefined;
|
|
57
|
+
clientId: string;
|
|
58
|
+
clientStore: OAuthClientStore;
|
|
59
|
+
registrationTokenStore: ClientRegistrationTokenStore;
|
|
60
|
+
}) => Promise<{
|
|
61
|
+
readonly body: {
|
|
62
|
+
readonly error: "invalid_token";
|
|
63
|
+
};
|
|
64
|
+
readonly status: 401;
|
|
65
|
+
} | {
|
|
66
|
+
readonly body: {
|
|
67
|
+
readonly error: "invalid_client";
|
|
68
|
+
};
|
|
69
|
+
readonly status: 404;
|
|
70
|
+
} | {
|
|
71
|
+
readonly body: ClientRegistrationMetadata & {
|
|
72
|
+
client_id: string;
|
|
73
|
+
};
|
|
74
|
+
readonly status: 200;
|
|
75
|
+
}>;
|
|
76
|
+
export declare const registerClient: ({ clientStore, initialAccessTokenStore, metadata, onClientRegistration, presentedInitialAccessToken, registrationBaseUrl, registrationTokenStore }: {
|
|
77
|
+
clientStore: OAuthClientStore;
|
|
78
|
+
initialAccessTokenStore?: InitialAccessTokenStore;
|
|
79
|
+
metadata: ClientRegistrationMetadata;
|
|
80
|
+
onClientRegistration?: OnClientRegistration;
|
|
81
|
+
presentedInitialAccessToken?: string;
|
|
82
|
+
registrationBaseUrl: string;
|
|
83
|
+
registrationTokenStore: ClientRegistrationTokenStore;
|
|
84
|
+
}) => Promise<RegisterClientResult>;
|
|
85
|
+
export declare const updateRegisteredClient: ({ authorization, clientId, clientStore, metadata, onClientRegistration, registrationTokenStore }: {
|
|
86
|
+
authorization: string | undefined;
|
|
87
|
+
clientId: string;
|
|
88
|
+
clientStore: OAuthClientStore;
|
|
89
|
+
metadata: ClientRegistrationMetadata;
|
|
90
|
+
onClientRegistration?: OnClientRegistration;
|
|
91
|
+
registrationTokenStore: ClientRegistrationTokenStore;
|
|
92
|
+
}) => Promise<{
|
|
93
|
+
readonly body: {
|
|
94
|
+
readonly error: "unsupported_response_type";
|
|
95
|
+
readonly error_description?: undefined;
|
|
96
|
+
};
|
|
97
|
+
readonly status: 501;
|
|
98
|
+
} | {
|
|
99
|
+
readonly body: {
|
|
100
|
+
readonly error: "invalid_token";
|
|
101
|
+
readonly error_description?: undefined;
|
|
102
|
+
};
|
|
103
|
+
readonly status: 401;
|
|
104
|
+
} | {
|
|
105
|
+
readonly body: {
|
|
106
|
+
readonly error: "invalid_client_metadata";
|
|
107
|
+
readonly error_description: string;
|
|
108
|
+
};
|
|
109
|
+
readonly status: 403;
|
|
110
|
+
} | {
|
|
111
|
+
readonly body: {
|
|
112
|
+
readonly error: "invalid_redirect_uri";
|
|
113
|
+
readonly error_description?: undefined;
|
|
114
|
+
};
|
|
115
|
+
readonly status: 400;
|
|
116
|
+
} | {
|
|
117
|
+
readonly body: {
|
|
118
|
+
readonly registration_access_token: string;
|
|
119
|
+
readonly backchannel_logout_uri?: string;
|
|
120
|
+
readonly client_name?: string;
|
|
121
|
+
readonly jwks?: JsonWebKey[];
|
|
122
|
+
readonly jwks_uri?: string;
|
|
123
|
+
readonly post_logout_redirect_uris?: string[];
|
|
124
|
+
readonly redirect_uris?: string[];
|
|
125
|
+
readonly scope?: string;
|
|
126
|
+
readonly client_id: string;
|
|
127
|
+
readonly error?: undefined;
|
|
128
|
+
readonly error_description?: undefined;
|
|
129
|
+
};
|
|
130
|
+
readonly status: 200;
|
|
131
|
+
}>;
|
package/dist/oidc/routes.d.ts
CHANGED
|
@@ -65,6 +65,8 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
|
|
|
65
65
|
grant_type?: string | undefined;
|
|
66
66
|
code?: string | undefined;
|
|
67
67
|
redirect_uri?: string | undefined;
|
|
68
|
+
client_assertion?: string | undefined;
|
|
69
|
+
client_assertion_type?: string | undefined;
|
|
68
70
|
code_verifier?: string | undefined;
|
|
69
71
|
subject_token?: string | undefined;
|
|
70
72
|
subject_token_type?: string | undefined;
|
|
@@ -245,6 +247,126 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
|
|
|
245
247
|
};
|
|
246
248
|
};
|
|
247
249
|
};
|
|
250
|
+
} & {
|
|
251
|
+
[x: string]: {
|
|
252
|
+
post: {
|
|
253
|
+
body: {
|
|
254
|
+
jwks?: any;
|
|
255
|
+
scope?: string | undefined;
|
|
256
|
+
backchannel_logout_uri?: string | undefined;
|
|
257
|
+
client_name?: string | undefined;
|
|
258
|
+
jwks_uri?: string | undefined;
|
|
259
|
+
post_logout_redirect_uris?: string[] | undefined;
|
|
260
|
+
redirect_uris?: string[] | undefined;
|
|
261
|
+
};
|
|
262
|
+
params: {};
|
|
263
|
+
query: unknown;
|
|
264
|
+
headers: {
|
|
265
|
+
authorization?: string | undefined;
|
|
266
|
+
};
|
|
267
|
+
response: {
|
|
268
|
+
200: Response;
|
|
269
|
+
422: {
|
|
270
|
+
type: "validation";
|
|
271
|
+
on: string;
|
|
272
|
+
summary?: string;
|
|
273
|
+
message?: string;
|
|
274
|
+
found?: unknown;
|
|
275
|
+
property?: string;
|
|
276
|
+
expected?: string;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
} & {
|
|
282
|
+
[x: string]: {
|
|
283
|
+
":clientId": {
|
|
284
|
+
get: {
|
|
285
|
+
body: unknown;
|
|
286
|
+
params: {
|
|
287
|
+
clientId: string;
|
|
288
|
+
};
|
|
289
|
+
query: unknown;
|
|
290
|
+
headers: {
|
|
291
|
+
authorization?: string | undefined;
|
|
292
|
+
};
|
|
293
|
+
response: {
|
|
294
|
+
200: Response;
|
|
295
|
+
422: {
|
|
296
|
+
type: "validation";
|
|
297
|
+
on: string;
|
|
298
|
+
summary?: string;
|
|
299
|
+
message?: string;
|
|
300
|
+
found?: unknown;
|
|
301
|
+
property?: string;
|
|
302
|
+
expected?: string;
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
} & {
|
|
309
|
+
[x: string]: {
|
|
310
|
+
":clientId": {
|
|
311
|
+
put: {
|
|
312
|
+
body: {
|
|
313
|
+
jwks?: any;
|
|
314
|
+
scope?: string | undefined;
|
|
315
|
+
backchannel_logout_uri?: string | undefined;
|
|
316
|
+
client_name?: string | undefined;
|
|
317
|
+
jwks_uri?: string | undefined;
|
|
318
|
+
post_logout_redirect_uris?: string[] | undefined;
|
|
319
|
+
redirect_uris?: string[] | undefined;
|
|
320
|
+
};
|
|
321
|
+
params: {
|
|
322
|
+
clientId: string;
|
|
323
|
+
};
|
|
324
|
+
query: unknown;
|
|
325
|
+
headers: {
|
|
326
|
+
authorization?: string | undefined;
|
|
327
|
+
};
|
|
328
|
+
response: {
|
|
329
|
+
200: Response;
|
|
330
|
+
422: {
|
|
331
|
+
type: "validation";
|
|
332
|
+
on: string;
|
|
333
|
+
summary?: string;
|
|
334
|
+
message?: string;
|
|
335
|
+
found?: unknown;
|
|
336
|
+
property?: string;
|
|
337
|
+
expected?: string;
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
} & {
|
|
344
|
+
[x: string]: {
|
|
345
|
+
":clientId": {
|
|
346
|
+
delete: {
|
|
347
|
+
body: unknown;
|
|
348
|
+
params: {
|
|
349
|
+
clientId: string;
|
|
350
|
+
};
|
|
351
|
+
query: unknown;
|
|
352
|
+
headers: {
|
|
353
|
+
authorization?: string | undefined;
|
|
354
|
+
};
|
|
355
|
+
response: {
|
|
356
|
+
200: Response;
|
|
357
|
+
422: {
|
|
358
|
+
type: "validation";
|
|
359
|
+
on: string;
|
|
360
|
+
summary?: string;
|
|
361
|
+
message?: string;
|
|
362
|
+
found?: unknown;
|
|
363
|
+
property?: string;
|
|
364
|
+
expected?: string;
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
};
|
|
248
370
|
} & {
|
|
249
371
|
[x: string]: {
|
|
250
372
|
get: {
|
package/dist/oidc/types.d.ts
CHANGED
|
@@ -2,13 +2,34 @@ export type OAuthClient = {
|
|
|
2
2
|
backchannelLogoutUri?: string;
|
|
3
3
|
clientId: string;
|
|
4
4
|
hashedSecret?: string;
|
|
5
|
+
jwks?: JsonWebKey[];
|
|
6
|
+
jwksUri?: string;
|
|
5
7
|
name: string;
|
|
6
8
|
postLogoutRedirectUris?: string[];
|
|
7
9
|
redirectUris: string[];
|
|
8
10
|
scopes: string[];
|
|
9
11
|
};
|
|
12
|
+
export type ClientAssertionJtiStore = {
|
|
13
|
+
recordIfFresh: (clientId: string, jti: string, expiresAt: number) => Promise<boolean>;
|
|
14
|
+
};
|
|
10
15
|
export type OAuthClientStore = {
|
|
16
|
+
deleteClient?: (clientId: string) => Promise<void>;
|
|
11
17
|
findClient: (clientId: string) => Promise<OAuthClient | undefined>;
|
|
18
|
+
saveClient?: (client: OAuthClient) => Promise<void>;
|
|
19
|
+
updateClient?: (clientId: string, client: OAuthClient) => Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
export type ClientRegistrationToken = {
|
|
22
|
+
clientId: string;
|
|
23
|
+
createdAt: number;
|
|
24
|
+
tokenHash: string;
|
|
25
|
+
};
|
|
26
|
+
export type ClientRegistrationTokenStore = {
|
|
27
|
+
deleteByClientId: (clientId: string) => Promise<void>;
|
|
28
|
+
findByTokenHash: (tokenHash: string) => Promise<ClientRegistrationToken | undefined>;
|
|
29
|
+
saveToken: (token: ClientRegistrationToken) => Promise<void>;
|
|
30
|
+
};
|
|
31
|
+
export type InitialAccessTokenStore = {
|
|
32
|
+
consumeToken: (tokenHash: string) => Promise<boolean>;
|
|
12
33
|
};
|
|
13
34
|
export type AuthorizationCode = {
|
|
14
35
|
claims?: Record<string, unknown>;
|