@absolutejs/auth 0.29.2 → 0.30.0-beta.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/dist/index.d.ts +55 -2
- package/dist/index.js +114 -10
- package/dist/index.js.map +8 -7
- package/dist/oidc/config.d.ts +1 -0
- package/dist/oidc/routes.d.ts +53 -2
- package/dist/oidc/userinfo.d.ts +21 -0
- package/package.json +2 -1
package/dist/oidc/config.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export type OidcProviderConfig<UserType> = {
|
|
|
29
29
|
user: UserType;
|
|
30
30
|
}) => string[] | undefined | Promise<string[] | undefined>;
|
|
31
31
|
getUserId: (user: UserType) => string;
|
|
32
|
+
getUserInfo?: (sub: string) => Promise<Record<string, unknown> | undefined>;
|
|
32
33
|
idTokenTtlMs?: number;
|
|
33
34
|
issuer: string;
|
|
34
35
|
dpopNonce?: {
|
package/dist/oidc/routes.d.ts
CHANGED
|
@@ -35,6 +35,9 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
|
|
|
35
35
|
acr_values?: string | undefined;
|
|
36
36
|
code_challenge?: string | undefined;
|
|
37
37
|
code_challenge_method?: string | undefined;
|
|
38
|
+
id_token_hint?: string | undefined;
|
|
39
|
+
max_age?: string | undefined;
|
|
40
|
+
prompt?: string | undefined;
|
|
38
41
|
request_uri?: string | undefined;
|
|
39
42
|
response_type?: string | undefined;
|
|
40
43
|
state?: string | undefined;
|
|
@@ -244,8 +247,8 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
|
|
|
244
247
|
params: {};
|
|
245
248
|
query: {
|
|
246
249
|
client_id?: string | undefined;
|
|
247
|
-
state?: string | undefined;
|
|
248
250
|
id_token_hint?: string | undefined;
|
|
251
|
+
state?: string | undefined;
|
|
249
252
|
post_logout_redirect_uri?: string | undefined;
|
|
250
253
|
};
|
|
251
254
|
headers: unknown;
|
|
@@ -268,8 +271,8 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
|
|
|
268
271
|
post: {
|
|
269
272
|
body: {
|
|
270
273
|
client_id?: string | undefined;
|
|
271
|
-
state?: string | undefined;
|
|
272
274
|
id_token_hint?: string | undefined;
|
|
275
|
+
state?: string | undefined;
|
|
273
276
|
post_logout_redirect_uri?: string | undefined;
|
|
274
277
|
};
|
|
275
278
|
params: {};
|
|
@@ -409,6 +412,54 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
|
|
|
409
412
|
};
|
|
410
413
|
};
|
|
411
414
|
};
|
|
415
|
+
} & {
|
|
416
|
+
[x: string]: {
|
|
417
|
+
get: {
|
|
418
|
+
body: unknown;
|
|
419
|
+
params: {};
|
|
420
|
+
query: unknown;
|
|
421
|
+
headers: {
|
|
422
|
+
authorization?: string | undefined;
|
|
423
|
+
};
|
|
424
|
+
response: {
|
|
425
|
+
200: Response;
|
|
426
|
+
422: {
|
|
427
|
+
type: "validation";
|
|
428
|
+
on: string;
|
|
429
|
+
summary?: string;
|
|
430
|
+
message?: string;
|
|
431
|
+
found?: unknown;
|
|
432
|
+
property?: string;
|
|
433
|
+
expected?: string;
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
};
|
|
438
|
+
} & {
|
|
439
|
+
[x: string]: {
|
|
440
|
+
post: {
|
|
441
|
+
body: {
|
|
442
|
+
access_token?: string | undefined;
|
|
443
|
+
};
|
|
444
|
+
params: {};
|
|
445
|
+
query: unknown;
|
|
446
|
+
headers: {
|
|
447
|
+
authorization?: string | undefined;
|
|
448
|
+
};
|
|
449
|
+
response: {
|
|
450
|
+
200: Response;
|
|
451
|
+
422: {
|
|
452
|
+
type: "validation";
|
|
453
|
+
on: string;
|
|
454
|
+
summary?: string;
|
|
455
|
+
message?: string;
|
|
456
|
+
found?: unknown;
|
|
457
|
+
property?: string;
|
|
458
|
+
expected?: string;
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
};
|
|
412
463
|
} & {
|
|
413
464
|
[x: string]: {
|
|
414
465
|
get: {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OidcProviderConfig } from './config';
|
|
2
|
+
export type UserInfoResult = {
|
|
3
|
+
body: Record<string, unknown> & {
|
|
4
|
+
sub: string;
|
|
5
|
+
};
|
|
6
|
+
ok: true;
|
|
7
|
+
} | {
|
|
8
|
+
body: {
|
|
9
|
+
error: string;
|
|
10
|
+
error_description?: string;
|
|
11
|
+
};
|
|
12
|
+
error: 'invalid_request' | 'invalid_token';
|
|
13
|
+
ok: false;
|
|
14
|
+
};
|
|
15
|
+
export declare const readUserInfoBearer: (authorization: string | undefined) => string | undefined;
|
|
16
|
+
export declare const fetchUserInfo: <UserType>({ config, now, token }: {
|
|
17
|
+
config: OidcProviderConfig<UserType>;
|
|
18
|
+
now?: number;
|
|
19
|
+
token: string | undefined;
|
|
20
|
+
}) => Promise<UserInfoResult>;
|
|
21
|
+
export declare const userInfoChallengeHeader: (error: "invalid_request" | "invalid_token") => string;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.30.0-beta.0",
|
|
3
3
|
"name": "@absolutejs/auth",
|
|
4
4
|
"description": "An authorization library for absolutejs",
|
|
5
5
|
"repository": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"test": "bun test",
|
|
16
16
|
"format": "absolute prettier --write",
|
|
17
17
|
"lint": "absolute eslint",
|
|
18
|
+
"prepublishOnly": "bun run build",
|
|
18
19
|
"typecheck": "absolute typecheck",
|
|
19
20
|
"release": "bun run format && bun run build && bun publish"
|
|
20
21
|
},
|