@schemavaults/auth-common 0.25.0 → 0.26.1
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/audience-schema.d.ts +2 -2
- package/dist/audience-schema.js +0 -1
- package/dist/audience-schema.js.map +1 -1
- package/dist/auth_acquire_tokens_grant_types.d.ts +12 -42
- package/dist/auth_acquire_tokens_grant_types.js +1 -1
- package/dist/auth_acquire_tokens_grant_types.js.map +1 -1
- package/dist/authenticate_result.d.ts +29 -144
- package/dist/authenticate_result.js +2 -2
- package/dist/authenticate_result.js.map +1 -1
- package/dist/authorize-client-application-form-type.d.ts +2 -6
- package/dist/credentials/email_credentials.d.ts +3 -9
- package/dist/credentials/normalize-email.d.ts +1 -1
- package/dist/credentials/normalize-email.js +5 -1
- package/dist/credentials/normalize-email.js.map +1 -1
- package/dist/credentials/password_requirements.d.ts +1 -1
- package/dist/credentials/register_credentials.d.ts +6 -26
- package/dist/invite-code/invite-code-definition.d.ts +5 -17
- package/dist/invite-code/invite-code-definition.js +1 -1
- package/dist/invite-code/invite-code-definition.js.map +1 -1
- package/dist/mfa/mfa-challenge.d.ts +2 -8
- package/dist/mfa/mfa-challenge.js +1 -1
- package/dist/mfa/mfa-challenge.js.map +1 -1
- package/dist/mfa/mfa-factor-type.d.ts +4 -1
- package/dist/mfa/mfa-verify-body.d.ts +57 -315
- package/dist/mfa/mfa-verify-body.js +9 -9
- package/dist/mfa/mfa-verify-body.js.map +1 -1
- package/dist/mfa/webauthn.d.ts +21 -145
- package/dist/mfa/webauthn.js +3 -3
- package/dist/mfa/webauthn.js.map +1 -1
- package/dist/middleware/auth-middleware-error.d.ts +1 -1
- package/dist/middleware/middleware-rules.d.ts +11 -15
- package/dist/oidc/endpoints.d.ts +32 -0
- package/dist/oidc/endpoints.js +42 -0
- package/dist/oidc/endpoints.js.map +1 -0
- package/dist/oidc/index.d.ts +6 -0
- package/dist/oidc/index.js +3 -0
- package/dist/oidc/index.js.map +1 -1
- package/dist/oidc/provider-metadata.d.ts +51 -0
- package/dist/oidc/provider-metadata.js +94 -0
- package/dist/oidc/provider-metadata.js.map +1 -0
- package/dist/oidc/token-endpoint-extensions.d.ts +58 -0
- package/dist/oidc/token-endpoint-extensions.js +69 -0
- package/dist/oidc/token-endpoint-extensions.js.map +1 -0
- package/dist/organizations/invite_member_form.d.ts +8 -21
- package/dist/organizations/invite_member_form.js +5 -5
- package/dist/organizations/invite_member_form.js.map +1 -1
- package/dist/organizations/organization-membership-role-type.d.ts +1 -1
- package/dist/organizations/organization_definition.d.ts +5 -15
- package/dist/organizations/organization_definition.js +1 -1
- package/dist/organizations/organization_definition.js.map +1 -1
- package/dist/organizations/organization_invitation.d.ts +21 -33
- package/dist/organizations/organization_invitation.js +5 -5
- package/dist/organizations/organization_invitation.js.map +1 -1
- package/dist/organizations/organization_membership_role_details.d.ts +6 -18
- package/dist/pagination.d.ts +1 -7
- package/dist/pkce/code_challenge.d.ts +5 -13
- package/dist/pkce/code_verifier.d.ts +6 -16
- package/dist/pkce/pkce.d.ts +11 -29
- package/dist/request_tokens_result.d.ts +54 -524
- package/dist/token-data/token-data.d.ts +23 -73
- package/dist/token-data/token-data.js +1 -1
- package/dist/token-data/token-data.js.map +1 -1
- package/dist/user_data/user_data.d.ts +7 -71
- package/dist/user_data/user_data.js +3 -3
- package/dist/user_data/user_data.js.map +1 -1
- package/dist/user_data/user_profile.d.ts +4 -58
- package/package.json +3 -3
package/dist/mfa/webauthn.d.ts
CHANGED
|
@@ -2,181 +2,57 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const webauthnRegistrationResponseSchema: z.ZodObject<{
|
|
3
3
|
id: z.ZodString;
|
|
4
4
|
rawId: z.ZodString;
|
|
5
|
-
response: z.ZodObject<{},
|
|
5
|
+
response: z.ZodObject<{}, z.core.$loose>;
|
|
6
6
|
authenticatorAttachment: z.ZodOptional<z.ZodString>;
|
|
7
|
-
clientExtensionResults: z.ZodOptional<z.ZodObject<{},
|
|
7
|
+
clientExtensionResults: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
8
8
|
type: z.ZodString;
|
|
9
|
-
},
|
|
10
|
-
id: z.ZodString;
|
|
11
|
-
rawId: z.ZodString;
|
|
12
|
-
response: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
|
|
13
|
-
authenticatorAttachment: z.ZodOptional<z.ZodString>;
|
|
14
|
-
clientExtensionResults: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
15
|
-
type: z.ZodString;
|
|
16
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
17
|
-
id: z.ZodString;
|
|
18
|
-
rawId: z.ZodString;
|
|
19
|
-
response: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
|
|
20
|
-
authenticatorAttachment: z.ZodOptional<z.ZodString>;
|
|
21
|
-
clientExtensionResults: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
22
|
-
type: z.ZodString;
|
|
23
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
9
|
+
}, z.core.$loose>;
|
|
24
10
|
export type WebauthnRegistrationResponse = z.infer<typeof webauthnRegistrationResponseSchema>;
|
|
25
11
|
export declare const webauthnAuthenticationResponseSchema: z.ZodObject<{
|
|
26
12
|
id: z.ZodString;
|
|
27
13
|
rawId: z.ZodString;
|
|
28
|
-
response: z.ZodObject<{},
|
|
29
|
-
authenticatorAttachment: z.ZodOptional<z.ZodString>;
|
|
30
|
-
clientExtensionResults: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
31
|
-
type: z.ZodString;
|
|
32
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
33
|
-
id: z.ZodString;
|
|
34
|
-
rawId: z.ZodString;
|
|
35
|
-
response: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
|
|
14
|
+
response: z.ZodObject<{}, z.core.$loose>;
|
|
36
15
|
authenticatorAttachment: z.ZodOptional<z.ZodString>;
|
|
37
|
-
clientExtensionResults: z.ZodOptional<z.ZodObject<{},
|
|
16
|
+
clientExtensionResults: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
38
17
|
type: z.ZodString;
|
|
39
|
-
}, z.
|
|
40
|
-
id: z.ZodString;
|
|
41
|
-
rawId: z.ZodString;
|
|
42
|
-
response: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
|
|
43
|
-
authenticatorAttachment: z.ZodOptional<z.ZodString>;
|
|
44
|
-
clientExtensionResults: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
45
|
-
type: z.ZodString;
|
|
46
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
18
|
+
}, z.core.$loose>;
|
|
47
19
|
export type WebauthnAuthenticationResponse = z.infer<typeof webauthnAuthenticationResponseSchema>;
|
|
48
20
|
export declare const webauthnLabelSchema: z.ZodString;
|
|
49
21
|
export declare const webauthnEnrollOptionsResponseSchema: z.ZodObject<{
|
|
50
|
-
factor_id: z.
|
|
51
|
-
options: z.ZodObject<{},
|
|
52
|
-
},
|
|
53
|
-
options: {} & {
|
|
54
|
-
[k: string]: unknown;
|
|
55
|
-
};
|
|
56
|
-
factor_id: string;
|
|
57
|
-
}, {
|
|
58
|
-
options: {} & {
|
|
59
|
-
[k: string]: unknown;
|
|
60
|
-
};
|
|
61
|
-
factor_id: string;
|
|
62
|
-
}>;
|
|
22
|
+
factor_id: z.ZodGUID;
|
|
23
|
+
options: z.ZodObject<{}, z.core.$loose>;
|
|
24
|
+
}, z.core.$strict>;
|
|
63
25
|
export type WebauthnEnrollOptionsResponse = z.infer<typeof webauthnEnrollOptionsResponseSchema>;
|
|
64
26
|
export declare const webauthnVerifyEnrollmentBodySchema: z.ZodObject<{
|
|
65
|
-
factor_id: z.
|
|
27
|
+
factor_id: z.ZodGUID;
|
|
66
28
|
label: z.ZodOptional<z.ZodString>;
|
|
67
29
|
attestation: z.ZodObject<{
|
|
68
30
|
id: z.ZodString;
|
|
69
31
|
rawId: z.ZodString;
|
|
70
|
-
response: z.ZodObject<{},
|
|
71
|
-
authenticatorAttachment: z.ZodOptional<z.ZodString>;
|
|
72
|
-
clientExtensionResults: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
73
|
-
type: z.ZodString;
|
|
74
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
75
|
-
id: z.ZodString;
|
|
76
|
-
rawId: z.ZodString;
|
|
77
|
-
response: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
|
|
78
|
-
authenticatorAttachment: z.ZodOptional<z.ZodString>;
|
|
79
|
-
clientExtensionResults: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
80
|
-
type: z.ZodString;
|
|
81
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
82
|
-
id: z.ZodString;
|
|
83
|
-
rawId: z.ZodString;
|
|
84
|
-
response: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
|
|
32
|
+
response: z.ZodObject<{}, z.core.$loose>;
|
|
85
33
|
authenticatorAttachment: z.ZodOptional<z.ZodString>;
|
|
86
|
-
clientExtensionResults: z.ZodOptional<z.ZodObject<{},
|
|
34
|
+
clientExtensionResults: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
87
35
|
type: z.ZodString;
|
|
88
|
-
}, z.
|
|
89
|
-
},
|
|
90
|
-
factor_id: string;
|
|
91
|
-
attestation: {
|
|
92
|
-
type: string;
|
|
93
|
-
id: string;
|
|
94
|
-
rawId: string;
|
|
95
|
-
response: {} & {
|
|
96
|
-
[k: string]: unknown;
|
|
97
|
-
};
|
|
98
|
-
authenticatorAttachment?: string | undefined;
|
|
99
|
-
clientExtensionResults?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
100
|
-
} & {
|
|
101
|
-
[k: string]: unknown;
|
|
102
|
-
};
|
|
103
|
-
label?: string | undefined;
|
|
104
|
-
}, {
|
|
105
|
-
factor_id: string;
|
|
106
|
-
attestation: {
|
|
107
|
-
type: string;
|
|
108
|
-
id: string;
|
|
109
|
-
rawId: string;
|
|
110
|
-
response: {} & {
|
|
111
|
-
[k: string]: unknown;
|
|
112
|
-
};
|
|
113
|
-
authenticatorAttachment?: string | undefined;
|
|
114
|
-
clientExtensionResults?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
115
|
-
} & {
|
|
116
|
-
[k: string]: unknown;
|
|
117
|
-
};
|
|
118
|
-
label?: string | undefined;
|
|
119
|
-
}>;
|
|
36
|
+
}, z.core.$loose>;
|
|
37
|
+
}, z.core.$strict>;
|
|
120
38
|
export type WebauthnVerifyEnrollmentBody = z.infer<typeof webauthnVerifyEnrollmentBodySchema>;
|
|
121
39
|
export declare const webauthnAuthenticationOptionsResponseSchema: z.ZodObject<{
|
|
122
|
-
options: z.ZodObject<{},
|
|
123
|
-
},
|
|
124
|
-
options: {} & {
|
|
125
|
-
[k: string]: unknown;
|
|
126
|
-
};
|
|
127
|
-
}, {
|
|
128
|
-
options: {} & {
|
|
129
|
-
[k: string]: unknown;
|
|
130
|
-
};
|
|
131
|
-
}>;
|
|
40
|
+
options: z.ZodObject<{}, z.core.$loose>;
|
|
41
|
+
}, z.core.$strict>;
|
|
132
42
|
export type WebauthnAuthenticationOptionsResponse = z.infer<typeof webauthnAuthenticationOptionsResponseSchema>;
|
|
133
43
|
export declare const webauthnCredentialSummarySchema: z.ZodObject<{
|
|
134
|
-
factor_id: z.
|
|
44
|
+
factor_id: z.ZodGUID;
|
|
135
45
|
label: z.ZodNullable<z.ZodString>;
|
|
136
46
|
created_at: z.ZodNumber;
|
|
137
47
|
last_used_at: z.ZodNullable<z.ZodNumber>;
|
|
138
|
-
},
|
|
139
|
-
factor_id: string;
|
|
140
|
-
last_used_at: number | null;
|
|
141
|
-
created_at: number;
|
|
142
|
-
label: string | null;
|
|
143
|
-
}, {
|
|
144
|
-
factor_id: string;
|
|
145
|
-
last_used_at: number | null;
|
|
146
|
-
created_at: number;
|
|
147
|
-
label: string | null;
|
|
148
|
-
}>;
|
|
48
|
+
}, z.core.$strict>;
|
|
149
49
|
export type WebauthnCredentialSummary = z.infer<typeof webauthnCredentialSummarySchema>;
|
|
150
50
|
export declare const webauthnCredentialListResponseSchema: z.ZodObject<{
|
|
151
51
|
credentials: z.ZodArray<z.ZodObject<{
|
|
152
|
-
factor_id: z.
|
|
52
|
+
factor_id: z.ZodGUID;
|
|
153
53
|
label: z.ZodNullable<z.ZodString>;
|
|
154
54
|
created_at: z.ZodNumber;
|
|
155
55
|
last_used_at: z.ZodNullable<z.ZodNumber>;
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
last_used_at: number | null;
|
|
159
|
-
created_at: number;
|
|
160
|
-
label: string | null;
|
|
161
|
-
}, {
|
|
162
|
-
factor_id: string;
|
|
163
|
-
last_used_at: number | null;
|
|
164
|
-
created_at: number;
|
|
165
|
-
label: string | null;
|
|
166
|
-
}>, "many">;
|
|
167
|
-
}, "strict", z.ZodTypeAny, {
|
|
168
|
-
credentials: {
|
|
169
|
-
factor_id: string;
|
|
170
|
-
last_used_at: number | null;
|
|
171
|
-
created_at: number;
|
|
172
|
-
label: string | null;
|
|
173
|
-
}[];
|
|
174
|
-
}, {
|
|
175
|
-
credentials: {
|
|
176
|
-
factor_id: string;
|
|
177
|
-
last_used_at: number | null;
|
|
178
|
-
created_at: number;
|
|
179
|
-
label: string | null;
|
|
180
|
-
}[];
|
|
181
|
-
}>;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
}, z.core.$strict>;
|
|
182
58
|
export type WebauthnCredentialListResponse = z.infer<typeof webauthnCredentialListResponseSchema>;
|
package/dist/mfa/webauthn.js
CHANGED
|
@@ -41,7 +41,7 @@ export const webauthnLabelSchema = z
|
|
|
41
41
|
// enrollment will be confirmed against.
|
|
42
42
|
export const webauthnEnrollOptionsResponseSchema = z
|
|
43
43
|
.object({
|
|
44
|
-
factor_id: z.
|
|
44
|
+
factor_id: z.guid(),
|
|
45
45
|
// PublicKeyCredentialCreationOptionsJSON — opaque to us, handed to the
|
|
46
46
|
// browser verbatim.
|
|
47
47
|
options: z.object({}).passthrough(),
|
|
@@ -50,7 +50,7 @@ export const webauthnEnrollOptionsResponseSchema = z
|
|
|
50
50
|
// Body for POST /api/user/mfa/webauthn/verify-enrollment.
|
|
51
51
|
export const webauthnVerifyEnrollmentBodySchema = z
|
|
52
52
|
.object({
|
|
53
|
-
factor_id: z.
|
|
53
|
+
factor_id: z.guid(),
|
|
54
54
|
label: webauthnLabelSchema.optional(),
|
|
55
55
|
attestation: webauthnRegistrationResponseSchema,
|
|
56
56
|
})
|
|
@@ -66,7 +66,7 @@ export const webauthnAuthenticationOptionsResponseSchema = z
|
|
|
66
66
|
// A single enrolled passkey as surfaced to the account settings UI.
|
|
67
67
|
export const webauthnCredentialSummarySchema = z
|
|
68
68
|
.object({
|
|
69
|
-
factor_id: z.
|
|
69
|
+
factor_id: z.guid(),
|
|
70
70
|
label: z.string().nullable(),
|
|
71
71
|
created_at: z.number().int().positive(),
|
|
72
72
|
last_used_at: z.number().int().positive().nullable(),
|
package/dist/mfa/webauthn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webauthn.js","sourceRoot":"","sources":["../../src/mfa/webauthn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wEAAwE;AACxE,wEAAwE;AACxE,2EAA2E;AAC3E,0EAA0E;AAC1E,yEAAyE;AACzE,4EAA4E;AAC5E,6EAA6E;AAC7E,iDAAiD;AAEjD,8DAA8D;AAC9D,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC;KAChD,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE;IACpC,uBAAuB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9C,sBAAsB,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAC7D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxB,CAAC;KACD,WAAW,EAAE,CAA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AM,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const AuthMiddlewareErrorTypes: readonly ["Unauthorized", "Forbidden"];
|
|
3
3
|
export type AuthMiddlewareError = (typeof AuthMiddlewareErrorTypes)[number];
|
|
4
|
-
export declare const authMiddlewareErrorTypesSchema: z.
|
|
4
|
+
export declare const authMiddlewareErrorTypesSchema: z.ZodString & z.ZodType<"Unauthorized" | "Forbidden", string, z.core.$ZodTypeInternals<"Unauthorized" | "Forbidden", string>>;
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import type { SchemaVaultsAppEnvironment } from "@schemavaults/app-definitions";
|
|
2
2
|
import type { NavigationPath } from "./parse-navigation-path";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
export declare const pageSecurityLevelSchema: z.ZodEnum<
|
|
4
|
+
export declare const pageSecurityLevelSchema: z.ZodEnum<{
|
|
5
|
+
admin: "admin";
|
|
6
|
+
public: "public";
|
|
7
|
+
unauthed: "unauthed";
|
|
8
|
+
authed: "authed";
|
|
9
|
+
api: "api";
|
|
10
|
+
}>;
|
|
5
11
|
type PageSecurityLevel = z.infer<typeof pageSecurityLevelSchema>;
|
|
6
12
|
export type AuthMiddlewareRules = Record<PageSecurityLevel, NavigationPath[]>;
|
|
7
13
|
export declare const authenticationStatusSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
8
|
-
status: z.ZodLiteral<"logged-in"
|
|
14
|
+
status: z.ZodNonOptional<z.ZodLiteral<"logged-in">>;
|
|
9
15
|
admin: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
-
},
|
|
11
|
-
status: "logged-
|
|
12
|
-
|
|
13
|
-
}, {
|
|
14
|
-
status: "logged-in";
|
|
15
|
-
admin?: boolean | undefined;
|
|
16
|
-
}>, z.ZodObject<{
|
|
17
|
-
status: z.ZodLiteral<"logged-out">;
|
|
18
|
-
}, "strict", z.ZodTypeAny, {
|
|
19
|
-
status: "logged-out";
|
|
20
|
-
}, {
|
|
21
|
-
status: "logged-out";
|
|
22
|
-
}>]>;
|
|
16
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
17
|
+
status: z.ZodNonOptional<z.ZodLiteral<"logged-out">>;
|
|
18
|
+
}, z.core.$strict>]>;
|
|
23
19
|
export type AuthenticationStatus = z.infer<typeof authenticationStatusSchema>;
|
|
24
20
|
type AuthMiddlewareResult = readonly [
|
|
25
21
|
AuthenticationStatus["status"],
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OIDC / OAuth2 endpoint paths served by the auth server, relative to
|
|
3
|
+
* its issuer identifier (the auth server URL).
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth shared by:
|
|
6
|
+
* - the auth server's discovery document
|
|
7
|
+
* (`/.well-known/openid-configuration`), which advertises these
|
|
8
|
+
* absolute URLs, and
|
|
9
|
+
* - `@schemavaults/auth-client-sdk`, which builds its `openid-client`
|
|
10
|
+
* Configuration statically from the same paths (skipping a discovery
|
|
11
|
+
* round trip on every client instantiation).
|
|
12
|
+
*
|
|
13
|
+
* The SDK and server must agree byte-for-byte on these, so they are
|
|
14
|
+
* never hardcoded at either end.
|
|
15
|
+
*/
|
|
16
|
+
export declare const OIDC_ENDPOINT_PATHS: {
|
|
17
|
+
readonly discovery: "/.well-known/openid-configuration";
|
|
18
|
+
readonly authorization: "/api/oidc/authorize";
|
|
19
|
+
readonly token: "/api/oidc/token";
|
|
20
|
+
readonly userinfo: "/api/oidc/userinfo";
|
|
21
|
+
readonly introspection: "/api/oidc/introspect";
|
|
22
|
+
readonly jwks: "/api/oidc/jwks";
|
|
23
|
+
};
|
|
24
|
+
export type OidcEndpointName = keyof typeof OIDC_ENDPOINT_PATHS;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves an OIDC endpoint to its absolute URL for the given issuer.
|
|
27
|
+
*
|
|
28
|
+
* `issuer` is the auth server URL exactly as it appears in the `iss`
|
|
29
|
+
* claim (never with a trailing slash — see `getAuthServerUrl()`); a
|
|
30
|
+
* trailing slash is tolerated and stripped so the result is stable.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getOidcEndpointUrl(issuer: string, endpoint: OidcEndpointName): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OIDC / OAuth2 endpoint paths served by the auth server, relative to
|
|
3
|
+
* its issuer identifier (the auth server URL).
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth shared by:
|
|
6
|
+
* - the auth server's discovery document
|
|
7
|
+
* (`/.well-known/openid-configuration`), which advertises these
|
|
8
|
+
* absolute URLs, and
|
|
9
|
+
* - `@schemavaults/auth-client-sdk`, which builds its `openid-client`
|
|
10
|
+
* Configuration statically from the same paths (skipping a discovery
|
|
11
|
+
* round trip on every client instantiation).
|
|
12
|
+
*
|
|
13
|
+
* The SDK and server must agree byte-for-byte on these, so they are
|
|
14
|
+
* never hardcoded at either end.
|
|
15
|
+
*/
|
|
16
|
+
export const OIDC_ENDPOINT_PATHS = {
|
|
17
|
+
discovery: "/.well-known/openid-configuration",
|
|
18
|
+
authorization: "/api/oidc/authorize",
|
|
19
|
+
token: "/api/oidc/token",
|
|
20
|
+
userinfo: "/api/oidc/userinfo",
|
|
21
|
+
introspection: "/api/oidc/introspect",
|
|
22
|
+
jwks: "/api/oidc/jwks",
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Resolves an OIDC endpoint to its absolute URL for the given issuer.
|
|
26
|
+
*
|
|
27
|
+
* `issuer` is the auth server URL exactly as it appears in the `iss`
|
|
28
|
+
* claim (never with a trailing slash — see `getAuthServerUrl()`); a
|
|
29
|
+
* trailing slash is tolerated and stripped so the result is stable.
|
|
30
|
+
*/
|
|
31
|
+
export function getOidcEndpointUrl(issuer, endpoint) {
|
|
32
|
+
if (typeof issuer !== "string" || issuer.length === 0) {
|
|
33
|
+
throw new TypeError("Expected 'issuer' to be a non-empty string!");
|
|
34
|
+
}
|
|
35
|
+
const path = OIDC_ENDPOINT_PATHS[endpoint];
|
|
36
|
+
if (typeof path !== "string") {
|
|
37
|
+
throw new RangeError(`Unknown OIDC endpoint '${String(endpoint)}'`);
|
|
38
|
+
}
|
|
39
|
+
const base = issuer.endsWith("/") ? issuer.slice(0, -1) : issuer;
|
|
40
|
+
return `${base}${path}`;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../src/oidc/endpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS,EAAE,mCAAmC;IAC9C,aAAa,EAAE,qBAAqB;IACpC,KAAK,EAAE,iBAAiB;IACxB,QAAQ,EAAE,oBAAoB;IAC9B,aAAa,EAAE,sBAAsB;IACrC,IAAI,EAAE,gBAAgB;CACyB,CAAC;AAIlD;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,QAA0B;IAE1B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,SAAS,CAAC,6CAA6C,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,IAAI,GAA6B,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACrE,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,UAAU,CAAC,0BAA0B,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,IAAI,GAAW,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACzE,OAAO,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;AAC1B,CAAC"}
|
package/dist/oidc/index.d.ts
CHANGED
|
@@ -5,3 +5,9 @@ export type { OidcNonce } from "./nonce";
|
|
|
5
5
|
export { OIDC_SUB_CLAIM_DELIMITER, formatOidcSubClaim, parseOidcSubClaim, } from "./sub-claim";
|
|
6
6
|
export { buildOidcProfileClaims } from "./profile-claims";
|
|
7
7
|
export type { OidcProfileClaims, OidcProfileClaimsSource, } from "./profile-claims";
|
|
8
|
+
export { OIDC_ENDPOINT_PATHS, getOidcEndpointUrl } from "./endpoints";
|
|
9
|
+
export type { OidcEndpointName } from "./endpoints";
|
|
10
|
+
export { OIDC_TOKEN_RESOURCE_PARAM, OIDC_TOKEN_REFRESH_TOKEN_DELIVERY_PARAM, OIDC_REFRESH_TOKEN_DELIVERY_MODES, oidcRefreshTokenDeliveryModeSchema, DEFAULT_OIDC_REFRESH_TOKEN_DELIVERY_MODE, OIDC_TOKEN_REFRESH_TOKEN_EXPIRES_IN_FIELD, oidcTokenResponseExtensionsSchema, } from "./token-endpoint-extensions";
|
|
11
|
+
export type { OidcRefreshTokenDeliveryMode, OidcTokenResponseExtensions, } from "./token-endpoint-extensions";
|
|
12
|
+
export { buildOidcProviderMetadata } from "./provider-metadata";
|
|
13
|
+
export type { OidcProviderMetadata } from "./provider-metadata";
|
package/dist/oidc/index.js
CHANGED
|
@@ -2,4 +2,7 @@ export { OIDC_OPENID_SCOPE, OIDC_SUPPORTED_SCOPES, DEFAULT_AUTH_SCOPE, OIDC_SCOP
|
|
|
2
2
|
export { oidcNonceSchema, OIDC_NONCE_VSCHAR_REGEX, parseOidcNonce, OidcNonceValidationError, } from "./nonce";
|
|
3
3
|
export { OIDC_SUB_CLAIM_DELIMITER, formatOidcSubClaim, parseOidcSubClaim, } from "./sub-claim";
|
|
4
4
|
export { buildOidcProfileClaims } from "./profile-claims";
|
|
5
|
+
export { OIDC_ENDPOINT_PATHS, getOidcEndpointUrl } from "./endpoints";
|
|
6
|
+
export { OIDC_TOKEN_RESOURCE_PARAM, OIDC_TOKEN_REFRESH_TOKEN_DELIVERY_PARAM, OIDC_REFRESH_TOKEN_DELIVERY_MODES, oidcRefreshTokenDeliveryModeSchema, DEFAULT_OIDC_REFRESH_TOKEN_DELIVERY_MODE, OIDC_TOKEN_REFRESH_TOKEN_EXPIRES_IN_FIELD, oidcTokenResponseExtensionsSchema, } from "./token-endpoint-extensions";
|
|
7
|
+
export { buildOidcProviderMetadata } from "./provider-metadata";
|
|
5
8
|
//# sourceMappingURL=index.js.map
|
package/dist/oidc/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/oidc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAOjB,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/oidc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAOjB,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAM1D,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtE,OAAO,EACL,yBAAyB,EACzB,uCAAuC,EACvC,iCAAiC,EACjC,kCAAkC,EAClC,wCAAwC,EACxC,yCAAyC,EACzC,iCAAiC,GAClC,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenID Provider Metadata (OIDC Discovery 1.0 §3 / RFC 8414) for the
|
|
3
|
+
* auth server, as a pure function of its issuer identifier.
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth consumed by BOTH ends of the protocol:
|
|
6
|
+
* - the auth server serves it verbatim at
|
|
7
|
+
* /.well-known/openid-configuration, and
|
|
8
|
+
* - `@schemavaults/auth-client-sdk` hands the same object to
|
|
9
|
+
* `openid-client` as its server metadata instead of fetching the
|
|
10
|
+
* document (so the SDK can never drift from what the server
|
|
11
|
+
* advertises — a change here changes both sides together).
|
|
12
|
+
*
|
|
13
|
+
* `issuer` MUST be byte-identical to the `iss` claim in id_tokens and
|
|
14
|
+
* the `iss` authorization-response parameter — both derive from the auth
|
|
15
|
+
* server URL, which never carries a trailing slash.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The advertised metadata. List fields are plain mutable arrays because
|
|
19
|
+
* that is how `openid-client` types its `ServerMetadata`; treat them as
|
|
20
|
+
* read-only in practice (every call builds a fresh document). Declared
|
|
21
|
+
* as a type alias (not an interface) so it carries the implicit index
|
|
22
|
+
* signature `openid-client`'s metadata type requires.
|
|
23
|
+
*/
|
|
24
|
+
export type OidcProviderMetadata = {
|
|
25
|
+
issuer: string;
|
|
26
|
+
authorization_endpoint: string;
|
|
27
|
+
token_endpoint: string;
|
|
28
|
+
userinfo_endpoint: string;
|
|
29
|
+
introspection_endpoint: string;
|
|
30
|
+
jwks_uri: string;
|
|
31
|
+
response_types_supported: string[];
|
|
32
|
+
response_modes_supported: string[];
|
|
33
|
+
grant_types_supported: string[];
|
|
34
|
+
subject_types_supported: string[];
|
|
35
|
+
id_token_signing_alg_values_supported: string[];
|
|
36
|
+
scopes_supported: string[];
|
|
37
|
+
token_endpoint_auth_methods_supported: string[];
|
|
38
|
+
introspection_endpoint_auth_methods_supported: string[];
|
|
39
|
+
code_challenge_methods_supported: string[];
|
|
40
|
+
claims_supported: string[];
|
|
41
|
+
authorization_response_iss_parameter_supported: boolean;
|
|
42
|
+
request_parameter_supported: boolean;
|
|
43
|
+
request_uri_parameter_supported: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Builds the provider metadata for the auth server at `issuer`. A
|
|
47
|
+
* trailing slash on `issuer` is stripped so the endpoints and the
|
|
48
|
+
* `issuer` field stay consistent with the `iss` claim.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildOidcProviderMetadata(issuer: string): OidcProviderMetadata;
|
|
51
|
+
export default buildOidcProviderMetadata;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenID Provider Metadata (OIDC Discovery 1.0 §3 / RFC 8414) for the
|
|
3
|
+
* auth server, as a pure function of its issuer identifier.
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth consumed by BOTH ends of the protocol:
|
|
6
|
+
* - the auth server serves it verbatim at
|
|
7
|
+
* /.well-known/openid-configuration, and
|
|
8
|
+
* - `@schemavaults/auth-client-sdk` hands the same object to
|
|
9
|
+
* `openid-client` as its server metadata instead of fetching the
|
|
10
|
+
* document (so the SDK can never drift from what the server
|
|
11
|
+
* advertises — a change here changes both sides together).
|
|
12
|
+
*
|
|
13
|
+
* `issuer` MUST be byte-identical to the `iss` claim in id_tokens and
|
|
14
|
+
* the `iss` authorization-response parameter — both derive from the auth
|
|
15
|
+
* server URL, which never carries a trailing slash.
|
|
16
|
+
*/
|
|
17
|
+
import { getOidcEndpointUrl } from "./endpoints";
|
|
18
|
+
import { OIDC_SUPPORTED_SCOPES } from "./scope";
|
|
19
|
+
/**
|
|
20
|
+
* Builds the provider metadata for the auth server at `issuer`. A
|
|
21
|
+
* trailing slash on `issuer` is stripped so the endpoints and the
|
|
22
|
+
* `issuer` field stay consistent with the `iss` claim.
|
|
23
|
+
*/
|
|
24
|
+
export function buildOidcProviderMetadata(issuer) {
|
|
25
|
+
if (typeof issuer !== "string" || issuer.length === 0) {
|
|
26
|
+
throw new TypeError("Expected 'issuer' to be a non-empty string!");
|
|
27
|
+
}
|
|
28
|
+
const normalized_issuer = issuer.endsWith("/")
|
|
29
|
+
? issuer.slice(0, -1)
|
|
30
|
+
: issuer;
|
|
31
|
+
return {
|
|
32
|
+
issuer: normalized_issuer,
|
|
33
|
+
authorization_endpoint: getOidcEndpointUrl(normalized_issuer, "authorization"),
|
|
34
|
+
token_endpoint: getOidcEndpointUrl(normalized_issuer, "token"),
|
|
35
|
+
userinfo_endpoint: getOidcEndpointUrl(normalized_issuer, "userinfo"),
|
|
36
|
+
introspection_endpoint: getOidcEndpointUrl(normalized_issuer, "introspection"),
|
|
37
|
+
jwks_uri: getOidcEndpointUrl(normalized_issuer, "jwks"),
|
|
38
|
+
response_types_supported: ["code"],
|
|
39
|
+
response_modes_supported: ["query"],
|
|
40
|
+
grant_types_supported: ["authorization_code", "refresh_token"],
|
|
41
|
+
subject_types_supported: ["public"],
|
|
42
|
+
id_token_signing_alg_values_supported: ["RS256"],
|
|
43
|
+
scopes_supported: [...OIDC_SUPPORTED_SCOPES],
|
|
44
|
+
// Apps without a registered client secret are public clients
|
|
45
|
+
// ("none"); apps with one are confidential clients and must
|
|
46
|
+
// authenticate via client_secret_basic or client_secret_post.
|
|
47
|
+
// PKCE S256 is mandatory for every client either way.
|
|
48
|
+
token_endpoint_auth_methods_supported: [
|
|
49
|
+
"none",
|
|
50
|
+
"client_secret_basic",
|
|
51
|
+
"client_secret_post",
|
|
52
|
+
],
|
|
53
|
+
// RFC 7662 token introspection (advertised per RFC 8414 §2). "none"
|
|
54
|
+
// is deliberately absent: §2.1 requires the endpoint to be
|
|
55
|
+
// authorized, so only confidential clients may introspect.
|
|
56
|
+
introspection_endpoint_auth_methods_supported: [
|
|
57
|
+
"client_secret_basic",
|
|
58
|
+
"client_secret_post",
|
|
59
|
+
],
|
|
60
|
+
code_challenge_methods_supported: ["S256"],
|
|
61
|
+
claims_supported: [
|
|
62
|
+
"sub",
|
|
63
|
+
"iss",
|
|
64
|
+
"aud",
|
|
65
|
+
"exp",
|
|
66
|
+
"iat",
|
|
67
|
+
"nonce",
|
|
68
|
+
"email",
|
|
69
|
+
"email_verified",
|
|
70
|
+
// Profile-scoped claims (OIDC Core §5.1), derived from the user's
|
|
71
|
+
// stored profile name fields; emitted only when set.
|
|
72
|
+
"name",
|
|
73
|
+
"given_name",
|
|
74
|
+
"middle_name",
|
|
75
|
+
"family_name",
|
|
76
|
+
"preferred_username",
|
|
77
|
+
],
|
|
78
|
+
// RFC 9207: the auth server puts `iss` on every authorization
|
|
79
|
+
// response. Advertising it makes spec-compliant clients (including
|
|
80
|
+
// the platform SDK via openid-client) require and verify it on
|
|
81
|
+
// redirect callbacks — authorization-server mix-up protection.
|
|
82
|
+
authorization_response_iss_parameter_supported: true,
|
|
83
|
+
// Request Objects (JAR, OIDC Core §6 / RFC 9101) are not implemented;
|
|
84
|
+
// the authorize endpoint rejects `request`/`request_uri` with
|
|
85
|
+
// request_not_supported / request_uri_not_supported. Declared
|
|
86
|
+
// explicitly because OIDC Discovery §3 defaults
|
|
87
|
+
// request_uri_parameter_supported to TRUE when omitted — leaving it
|
|
88
|
+
// out would falsely advertise support.
|
|
89
|
+
request_parameter_supported: false,
|
|
90
|
+
request_uri_parameter_supported: false,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export default buildOidcProviderMetadata;
|
|
94
|
+
//# sourceMappingURL=provider-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-metadata.js","sourceRoot":"","sources":["../../src/oidc/prov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rB,oBAAoB;SACrB;QACD,oEAAoE;QACpE,2DAA2D;QAC3D,2DAA2D;QAC3D,6CAA6C,EAAE;YAC7C,qBAAqB;YACrB,oBAAoB;SACrB;QACD,gCAAgC,EAAE,CAAC,MAAM,CAAC;QAC1C,gBAAgB,EAAE;YAChB,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,OAAO;YACP,OAAO;YACP,gBAAgB;YAChB,kEAAkE;YAClE,qDAAqD;YACrD,MAAM;YACN,YAAY;YACZ,aAAa;YACb,aAAa;YACb,oBAAoB;SACrB;QACD,8DAA8D;QAC9D,mEAAmE;QACnE,+DAA+D;QAC/D,+DAA+D;QAC/D,8CAA8C,EAAE,IAAI;QACpD,sEAAsE;QACtE,8DAA8D;QAC9D,8DAA8D;QAC9D,gDAAgD;QAChD,oEAAoE;QACpE,uCAAuC;QACvC,2BAA2B,EAAE,KAAK;QAClC,+BAA+B,EAAE,KAAK;KACvC,CAAC;AACJ,CAAC;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token-endpoint request/response parameters used by the SchemaVaults
|
|
3
|
+
* SDKs on top of the standard OIDC token endpoint (`/api/oidc/token`).
|
|
4
|
+
*
|
|
5
|
+
* The platform's SDK clients need two things a plain OIDC relying party
|
|
6
|
+
* does not:
|
|
7
|
+
*
|
|
8
|
+
* 1. Access tokens for arbitrary registered API servers (the platform's
|
|
9
|
+
* authorization model is audience-based). This uses the STANDARD
|
|
10
|
+
* RFC 8707 `resource` parameter: the token endpoint mints the
|
|
11
|
+
* response's `access_token` for that audience instead of the
|
|
12
|
+
* reserved `oidc-userinfo` audience. Exactly one `resource` per
|
|
13
|
+
* token request (the platform issues one encrypted access token per
|
|
14
|
+
* audience, so it "only supports issuing an access token with a
|
|
15
|
+
* single audience" in RFC 8707 §2 terms).
|
|
16
|
+
*
|
|
17
|
+
* 2. Refresh tokens kept out of JavaScript for browser clients. This
|
|
18
|
+
* is a platform extension: the `refresh_token_delivery` request
|
|
19
|
+
* parameter asks the endpoint to set the refresh token as an
|
|
20
|
+
* HTTP-only cookie (scoped to the client app, on the auth server's
|
|
21
|
+
* domain) and OMIT `refresh_token` from the JSON body. RFC 6749
|
|
22
|
+
* §5.1 makes `refresh_token` OPTIONAL in the response, so
|
|
23
|
+
* spec-compliant client libraries (e.g. `openid-client`) accept
|
|
24
|
+
* such responses unchanged. The response always carries the
|
|
25
|
+
* extension field `refresh_token_expires_in` (seconds) so the client
|
|
26
|
+
* can track the session lifetime either way.
|
|
27
|
+
*
|
|
28
|
+
* Relying parties that send neither parameter get the plain OIDC
|
|
29
|
+
* behavior (userinfo-audience access token, refresh token inlined).
|
|
30
|
+
*/
|
|
31
|
+
import { z } from "zod";
|
|
32
|
+
/** RFC 8707 Resource Indicators request parameter name. */
|
|
33
|
+
export declare const OIDC_TOKEN_RESOURCE_PARAM: "resource";
|
|
34
|
+
/** Platform extension: how the refresh token is delivered to the client. */
|
|
35
|
+
export declare const OIDC_TOKEN_REFRESH_TOKEN_DELIVERY_PARAM: "refresh_token_delivery";
|
|
36
|
+
export declare const OIDC_REFRESH_TOKEN_DELIVERY_MODES: readonly ["inline", "http_only_cookie"];
|
|
37
|
+
export declare const oidcRefreshTokenDeliveryModeSchema: z.ZodEnum<{
|
|
38
|
+
inline: "inline";
|
|
39
|
+
http_only_cookie: "http_only_cookie";
|
|
40
|
+
}>;
|
|
41
|
+
export type OidcRefreshTokenDeliveryMode = z.infer<typeof oidcRefreshTokenDeliveryModeSchema>;
|
|
42
|
+
export declare const DEFAULT_OIDC_REFRESH_TOKEN_DELIVERY_MODE: "inline";
|
|
43
|
+
/**
|
|
44
|
+
* Platform extension response field: seconds until the (possibly
|
|
45
|
+
* cookie-delivered) refresh token expires. Named after the widely used
|
|
46
|
+
* non-standard field of the same name (GitHub, Keycloak's
|
|
47
|
+
* `refresh_expires_in`, ...).
|
|
48
|
+
*/
|
|
49
|
+
export declare const OIDC_TOKEN_REFRESH_TOKEN_EXPIRES_IN_FIELD: "refresh_token_expires_in";
|
|
50
|
+
/**
|
|
51
|
+
* Shape of the extension fields the SDK reads off a token response.
|
|
52
|
+
* `refresh_token_expires_in` is emitted by the auth server on every
|
|
53
|
+
* successful response whose grant issued a refresh token.
|
|
54
|
+
*/
|
|
55
|
+
export declare const oidcTokenResponseExtensionsSchema: z.ZodObject<{
|
|
56
|
+
refresh_token_expires_in: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
}, z.core.$loose>;
|
|
58
|
+
export type OidcTokenResponseExtensions = z.infer<typeof oidcTokenResponseExtensionsSchema>;
|