@absolutejs/auth 0.29.0-beta.1 → 0.29.0-beta.2
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/index.d.ts +5 -2
- package/dist/index.js +189 -9
- package/dist/index.js.map +9 -8
- package/dist/oidc/clientAuth.d.ts +8 -0
- package/dist/oidc/config.d.ts +2 -1
- package/dist/oidc/inMemoryStores.d.ts +2 -1
- package/dist/oidc/postgresStores.d.ts +122 -1
- package/dist/oidc/routes.d.ts +2 -0
- package/dist/oidc/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -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,11 @@
|
|
|
1
1
|
import type { RouteString } from '../types';
|
|
2
2
|
import { type SigningKey } from './keys';
|
|
3
|
-
import type { AuthorizationCodeStore, DeviceAuthorizationStore, LogoutDeliveryStore, OAuthClientStore, OidcRefreshTokenStore } from './types';
|
|
3
|
+
import type { AuthorizationCodeStore, ClientAssertionJtiStore, DeviceAuthorizationStore, LogoutDeliveryStore, OAuthClientStore, OidcRefreshTokenStore } from './types';
|
|
4
4
|
export declare const DEFAULT_OIDC_ROUTE: RouteString;
|
|
5
5
|
export type OidcProviderConfig<UserType> = {
|
|
6
6
|
accessTokenTtlMs?: number;
|
|
7
7
|
authorizationCodeStore: AuthorizationCodeStore;
|
|
8
|
+
clientAssertionJtiStore?: ClientAssertionJtiStore;
|
|
8
9
|
clientStore: OAuthClientStore;
|
|
9
10
|
deviceAuthorizationStore?: DeviceAuthorizationStore;
|
|
10
11
|
deviceCodeTtlMs?: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { AuthorizationCodeStore, DeviceAuthorizationStore, LogoutDeliveryStore, OAuthClient, OAuthClientStore, OidcRefreshTokenStore } from './types';
|
|
1
|
+
import type { AuthorizationCodeStore, ClientAssertionJtiStore, DeviceAuthorizationStore, 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;
|
|
5
6
|
export declare const createInMemoryOAuthClientStore: (clients: OAuthClient[]) => OAuthClientStore;
|
|
@@ -1,5 +1,86 @@
|
|
|
1
1
|
import { type AnyPgDatabase } from '../stores/postgres';
|
|
2
|
-
import type { AuthorizationCodeStore, DeviceAuthorizationStore, LogoutDeliveryStore, OAuthClientStore, OidcRefreshTokenStore } from './types';
|
|
2
|
+
import type { AuthorizationCodeStore, ClientAssertionJtiStore, DeviceAuthorizationStore, 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
|
+
}>;
|
|
3
84
|
export declare const oauthClientsTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
85
|
name: "auth_oauth_clients";
|
|
5
86
|
schema: undefined;
|
|
@@ -61,6 +142,44 @@ export declare const oauthClientsTable: import("drizzle-orm/pg-core").PgTableWit
|
|
|
61
142
|
}, {}, {
|
|
62
143
|
length: 255;
|
|
63
144
|
}>;
|
|
145
|
+
jwks_json: import("drizzle-orm/pg-core").PgColumn<{
|
|
146
|
+
name: "jwks_json";
|
|
147
|
+
tableName: "auth_oauth_clients";
|
|
148
|
+
dataType: "json";
|
|
149
|
+
columnType: "PgJsonb";
|
|
150
|
+
data: JsonWebKey[];
|
|
151
|
+
driverParam: unknown;
|
|
152
|
+
notNull: false;
|
|
153
|
+
hasDefault: false;
|
|
154
|
+
isPrimaryKey: false;
|
|
155
|
+
isAutoincrement: false;
|
|
156
|
+
hasRuntimeDefault: false;
|
|
157
|
+
enumValues: undefined;
|
|
158
|
+
baseColumn: never;
|
|
159
|
+
identity: undefined;
|
|
160
|
+
generated: undefined;
|
|
161
|
+
}, {}, {
|
|
162
|
+
$type: JsonWebKey[];
|
|
163
|
+
}>;
|
|
164
|
+
jwks_uri: import("drizzle-orm/pg-core").PgColumn<{
|
|
165
|
+
name: "jwks_uri";
|
|
166
|
+
tableName: "auth_oauth_clients";
|
|
167
|
+
dataType: "string";
|
|
168
|
+
columnType: "PgVarchar";
|
|
169
|
+
data: string;
|
|
170
|
+
driverParam: string;
|
|
171
|
+
notNull: false;
|
|
172
|
+
hasDefault: false;
|
|
173
|
+
isPrimaryKey: false;
|
|
174
|
+
isAutoincrement: false;
|
|
175
|
+
hasRuntimeDefault: false;
|
|
176
|
+
enumValues: [string, ...string[]];
|
|
177
|
+
baseColumn: never;
|
|
178
|
+
identity: undefined;
|
|
179
|
+
generated: undefined;
|
|
180
|
+
}, {}, {
|
|
181
|
+
length: 2048;
|
|
182
|
+
}>;
|
|
64
183
|
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
65
184
|
name: "name";
|
|
66
185
|
tableName: "auth_oauth_clients";
|
|
@@ -992,11 +1111,13 @@ export declare const oauthRefreshTokensTable: import("drizzle-orm/pg-core").PgTa
|
|
|
992
1111
|
dialect: "pg";
|
|
993
1112
|
}>;
|
|
994
1113
|
export declare const createNeonAuthorizationCodeStore: (databaseUrl: string) => AuthorizationCodeStore;
|
|
1114
|
+
export declare const createNeonClientAssertionJtiStore: (databaseUrl: string) => ClientAssertionJtiStore;
|
|
995
1115
|
export declare const createNeonDeviceAuthorizationStore: (databaseUrl: string) => DeviceAuthorizationStore;
|
|
996
1116
|
export declare const createNeonLogoutDeliveryStore: (databaseUrl: string) => LogoutDeliveryStore;
|
|
997
1117
|
export declare const createNeonOAuthClientStore: (databaseUrl: string) => OAuthClientStore;
|
|
998
1118
|
export declare const createNeonOidcRefreshTokenStore: (databaseUrl: string) => OidcRefreshTokenStore;
|
|
999
1119
|
export declare const createPostgresAuthorizationCodeStore: (db: AnyPgDatabase) => AuthorizationCodeStore;
|
|
1120
|
+
export declare const createPostgresClientAssertionJtiStore: (db: AnyPgDatabase) => ClientAssertionJtiStore;
|
|
1000
1121
|
export declare const createPostgresDeviceAuthorizationStore: (db: AnyPgDatabase) => DeviceAuthorizationStore;
|
|
1001
1122
|
export declare const createPostgresLogoutDeliveryStore: (db: AnyPgDatabase) => LogoutDeliveryStore;
|
|
1002
1123
|
export declare const createPostgresOAuthClientStore: (db: AnyPgDatabase) => OAuthClientStore;
|
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;
|
package/dist/oidc/types.d.ts
CHANGED
|
@@ -2,11 +2,16 @@ 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 = {
|
|
11
16
|
findClient: (clientId: string) => Promise<OAuthClient | undefined>;
|
|
12
17
|
};
|
package/package.json
CHANGED