@schemavaults/auth-common 0.27.2 → 0.29.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/audience-schema.d.ts +32 -2
- package/dist/audience-schema.js +50 -1
- package/dist/audience-schema.js.map +1 -1
- package/dist/auth-error-message-catalog.d.ts +1 -1
- package/dist/auth-error-message-catalog.js +2 -0
- package/dist/auth-error-message-catalog.js.map +1 -1
- package/dist/authenticate_result.d.ts +10 -0
- package/dist/authenticate_result.js +18 -0
- package/dist/authenticate_result.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/oidc/dynamic-client-registration.d.ts +168 -0
- package/dist/oidc/dynamic-client-registration.js +355 -0
- package/dist/oidc/dynamic-client-registration.js.map +1 -0
- package/dist/oidc/endpoints.d.ts +1 -0
- package/dist/oidc/endpoints.js +3 -0
- package/dist/oidc/endpoints.js.map +1 -1
- package/dist/oidc/index.d.ts +3 -1
- package/dist/oidc/index.js +1 -0
- package/dist/oidc/index.js.map +1 -1
- package/dist/oidc/provider-metadata.d.ts +18 -1
- package/dist/oidc/provider-metadata.js +6 -1
- package/dist/oidc/provider-metadata.js.map +1 -1
- package/dist/request_tokens_result.d.ts +2 -2
- package/package.json +2 -2
|
@@ -16,7 +16,37 @@ export interface AudienceSchemaOverrides {
|
|
|
16
16
|
*/
|
|
17
17
|
auth_server_app_id?: string;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Longest RFC 8707 resource indicator URL accepted as a token audience;
|
|
21
|
+
* matches the callback URL cap so both URL-shaped inputs share a bound.
|
|
22
|
+
*/
|
|
23
|
+
export declare const RESOURCE_URL_AUDIENCE_MAX_LENGTH: 2048;
|
|
24
|
+
/**
|
|
25
|
+
* An RFC 8707 resource indicator in URL form: an absolute `https` (or
|
|
26
|
+
* `http`, for loopback / development resource servers) URL without a
|
|
27
|
+
* fragment (§2: "MUST NOT include a fragment component"). Resource
|
|
28
|
+
* servers that identify themselves by URL — MCP servers in particular —
|
|
29
|
+
* are matched against an API server's registered domains by the auth
|
|
30
|
+
* server, and the issued access token carries the URL verbatim as its
|
|
31
|
+
* `aud`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createResourceUrlAudienceSchema(z: typeof zod): zod.ZodURL;
|
|
34
|
+
/**
|
|
35
|
+
* A token audience is one of:
|
|
36
|
+
* - the auth server URL (tokens for the auth server itself),
|
|
37
|
+
* - a registered API server id (used verbatim as the `aud`), or
|
|
38
|
+
* - an RFC 8707 resource URL that the auth server resolves to a
|
|
39
|
+
* registered API server through its domains (`aud` = the URL).
|
|
40
|
+
* The bare auth app id is rejected everywhere.
|
|
41
|
+
*/
|
|
42
|
+
export declare function createAudienceSchema(z: typeof zod, environment?: SchemaVaultsAppEnvironment, overrides?: AudienceSchemaOverrides): zod.ZodUnion<readonly [zod.ZodURL & zod.ZodType<string, string, zod.core.$ZodTypeInternals<string, string>>, zod.ZodString, zod.ZodURL]>;
|
|
43
|
+
/**
|
|
44
|
+
* @description Whether a (schema-valid) token audience is an RFC 8707
|
|
45
|
+
* resource URL — i.e. a URL other than the auth server's own URL. Such
|
|
46
|
+
* an audience must be resolved to an API server before a token can be
|
|
47
|
+
* minted or verified for it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isResourceUrlAudience(audience: string, environment?: SchemaVaultsAppEnvironment, overrides?: AudienceSchemaOverrides): boolean;
|
|
20
50
|
/**
|
|
21
51
|
* A list of token audiences. The list may be empty: at the token endpoints
|
|
22
52
|
* an empty audience list means the grant mints no access tokens —
|
|
@@ -24,4 +54,4 @@ export declare function createAudienceSchema(z: typeof zod, environment?: Schema
|
|
|
24
54
|
* configured with no default token audiences complete a login. Call sites
|
|
25
55
|
* that require at least one audience must enforce non-emptiness themselves.
|
|
26
56
|
*/
|
|
27
|
-
export declare function createAudienceListSchema(z: typeof zod, environment?: SchemaVaultsAppEnvironment, overrides?: AudienceSchemaOverrides): zod.ZodArray<zod.ZodUnion<readonly [zod.ZodURL & zod.ZodType<string, string, zod.core.$ZodTypeInternals<string, string>>, zod.ZodString]>>;
|
|
57
|
+
export declare function createAudienceListSchema(z: typeof zod, environment?: SchemaVaultsAppEnvironment, overrides?: AudienceSchemaOverrides): zod.ZodArray<zod.ZodUnion<readonly [zod.ZodURL & zod.ZodType<string, string, zod.core.$ZodTypeInternals<string, string>>, zod.ZodString, zod.ZodURL]>>;
|
package/dist/audience-schema.js
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
import { apiServerIdSchema, getAppEnvironment, getAuthServerAppId, getAuthServerUrl, } from "@schemavaults/app-definitions";
|
|
2
|
+
/**
|
|
3
|
+
* Longest RFC 8707 resource indicator URL accepted as a token audience;
|
|
4
|
+
* matches the callback URL cap so both URL-shaped inputs share a bound.
|
|
5
|
+
*/
|
|
6
|
+
export const RESOURCE_URL_AUDIENCE_MAX_LENGTH = 2048;
|
|
7
|
+
/**
|
|
8
|
+
* An RFC 8707 resource indicator in URL form: an absolute `https` (or
|
|
9
|
+
* `http`, for loopback / development resource servers) URL without a
|
|
10
|
+
* fragment (§2: "MUST NOT include a fragment component"). Resource
|
|
11
|
+
* servers that identify themselves by URL — MCP servers in particular —
|
|
12
|
+
* are matched against an API server's registered domains by the auth
|
|
13
|
+
* server, and the issued access token carries the URL verbatim as its
|
|
14
|
+
* `aud`.
|
|
15
|
+
*/
|
|
16
|
+
export function createResourceUrlAudienceSchema(z) {
|
|
17
|
+
return z
|
|
18
|
+
.url({ protocol: /^https?$/ })
|
|
19
|
+
.max(RESOURCE_URL_AUDIENCE_MAX_LENGTH)
|
|
20
|
+
.refine((url) => !url.includes("#"), "A resource indicator must not include a fragment component")
|
|
21
|
+
.describe("An RFC 8707 resource indicator URL identifying a registered API server by one of its domains");
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A token audience is one of:
|
|
25
|
+
* - the auth server URL (tokens for the auth server itself),
|
|
26
|
+
* - a registered API server id (used verbatim as the `aud`), or
|
|
27
|
+
* - an RFC 8707 resource URL that the auth server resolves to a
|
|
28
|
+
* registered API server through its domains (`aud` = the URL).
|
|
29
|
+
* The bare auth app id is rejected everywhere.
|
|
30
|
+
*/
|
|
2
31
|
export function createAudienceSchema(z, environment = getAppEnvironment(), overrides) {
|
|
3
32
|
const auth_server_url = overrides?.auth_server_url ?? getAuthServerUrl(environment);
|
|
4
33
|
const auth_server_app_id = overrides?.auth_server_app_id ?? getAuthServerAppId();
|
|
@@ -11,7 +40,27 @@ export function createAudienceSchema(z, environment = getAppEnvironment(), overr
|
|
|
11
40
|
return id !== auth_server_app_id;
|
|
12
41
|
}, `Auth app ID ('${auth_server_app_id}') is not allowed as an audience; use the auth-server URL for tokens with the auth-server audience!`)
|
|
13
42
|
.describe(`An API server ID, but the auth app's ID (${auth_server_app_id}) is forbidden.`);
|
|
14
|
-
return z.union([
|
|
43
|
+
return z.union([
|
|
44
|
+
authServerUrlSchema,
|
|
45
|
+
apiServerIdWithoutAuthServerIdSchema,
|
|
46
|
+
createResourceUrlAudienceSchema(z),
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @description Whether a (schema-valid) token audience is an RFC 8707
|
|
51
|
+
* resource URL — i.e. a URL other than the auth server's own URL. Such
|
|
52
|
+
* an audience must be resolved to an API server before a token can be
|
|
53
|
+
* minted or verified for it.
|
|
54
|
+
*/
|
|
55
|
+
export function isResourceUrlAudience(audience, environment = getAppEnvironment(), overrides) {
|
|
56
|
+
if (typeof audience !== "string" || audience.length === 0) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const auth_server_url = overrides?.auth_server_url ?? getAuthServerUrl(environment);
|
|
60
|
+
if (audience === auth_server_url) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return /^https?:\/\//i.test(audience);
|
|
15
64
|
}
|
|
16
65
|
const MAX_APPS_IN_AUDIENCE_LIST = 10;
|
|
17
66
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audience-schema.js","sourceRoot":"","sources":["../src/audience-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,+BAA+B,CAAC;AA0BvC,MAAM,UAAU,oBAAoB,CAClC,CAAa,EACb,cAA0C,iBAAiB,EAAE,EAC7D,SAAmC;IAEnC,MAAM,eAAe,GACnB,SAAS,EAAE,eAAe,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC9D,MAAM,kBAAkB,GACtB,SAAS,EAAE,kBAAkB,IAAI,kBAAkB,EAAE,CAAC;IAExD,MAAM,mBAAmB,GAAG,CAAC;SAC1B,GAAG,EAAE;SACL,MAAM,CAAC,CAAC,GAAG,EAAiC,EAAE,CAAC,GAAG,KAAK,eAAe,CAAC;SACvE,QAAQ,CAAC,8DAA8D,CAAC,CAAC;IAE5E,MAAM,oCAAoC,GAAG,iBAAiB;SAC3D,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE;QACb,OAAO,EAAE,KAAK,kBAAkB,CAAC;IACnC,CAAC,EAAE,iBAAiB,kBAAkB,qGAAqG,CAAC;SAC3I,QAAQ,CACP,4CAA4C,kBAAkB,iBAAiB,CAChF,CAAC;IAEJ,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"audience-schema.js","sourceRoot":"","sources":["../src/audience-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,+BAA+B,CAAC;AA0BvC;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAa,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,UAAU,+BAA+B,CAAC,CAAa;IAC3D,OAAO,CAAC;SACL,GAAG,CAAC,EAAE,QAAQ,EAA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EAAE,eAAe,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC9D,IAAI,QAAQ,KAAK,eAAe,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,yBAAyB,GAAG,EAA4B,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACtC,CAAa,EACb,cAA0C,iBAAiB,EAAE,EAC7D,SAAmC;IAEnC,OAAO,oBAAoB,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC;SACnD,KAAK,EAAE;SACP,GAAG,CACF,yBAAyB,EACzB,2CAA2C,yBAAyB,uBAAuB,CAC5F,CAAC;AACN,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const ERROR_IDS: readonly ["unknown", "bad_request", "app_id_not_found", "api_server_id_not_found", "unauthenticated", "forbidden", "account_disabled", "load_user_data_failure", "internal_server_error", "load_server_config_failure", "server_misconfiguration", "account_not_in_organization", "pkce_challenge_expired", "invalid_redirect_uri"];
|
|
1
|
+
declare const ERROR_IDS: readonly ["unknown", "bad_request", "app_id_not_found", "api_server_id_not_found", "unauthenticated", "forbidden", "account_disabled", "load_user_data_failure", "internal_server_error", "load_server_config_failure", "server_misconfiguration", "account_not_in_organization", "pkce_challenge_expired", "invalid_redirect_uri", "email_verification_required"];
|
|
2
2
|
export type SchemaVaultsAuthErrorId = (typeof ERROR_IDS)[number];
|
|
3
3
|
export declare const ERROR_MESSAGE_CATALOG: Record<SchemaVaultsAuthErrorId, string>;
|
|
4
4
|
export declare function isValidErrorId(id: string): id is SchemaVaultsAuthErrorId;
|
|
@@ -13,6 +13,7 @@ const ERROR_IDS = [
|
|
|
13
13
|
"account_not_in_organization",
|
|
14
14
|
"pkce_challenge_expired",
|
|
15
15
|
"invalid_redirect_uri",
|
|
16
|
+
"email_verification_required",
|
|
16
17
|
];
|
|
17
18
|
export const ERROR_MESSAGE_CATALOG = {
|
|
18
19
|
unknown: "An unknown error occurred",
|
|
@@ -29,6 +30,7 @@ export const ERROR_MESSAGE_CATALOG = {
|
|
|
29
30
|
account_not_in_organization: "Your account is not a member of the organization required for the attempted action.",
|
|
30
31
|
pkce_challenge_expired: "Your authorization session has expired. Please return to the requesting application and try again.",
|
|
31
32
|
invalid_redirect_uri: "The redirect URI presented by the requesting application is not registered for it. For your safety, login has been blocked.",
|
|
33
|
+
email_verification_required: "Please verify your email address before continuing to the requesting application.",
|
|
32
34
|
};
|
|
33
35
|
export function isValidErrorId(id) {
|
|
34
36
|
return ERROR_IDS.includes(id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-error-message-catalog.js","sourceRoot":"","sources":["../src/auth-error-message-catalog.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG;IAChB,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,yBAAyB;IACzB,iBAAiB;IACjB,WAAW;IACX,kBAAkB;IAClB,wBAAwB;IACxB,uBAAuB;IACvB,4BAA4B;IAC5B,yBAAyB;IACzB,6BAA6B;IAC7B,wBAAwB;IACxB,sBAAsB;
|
|
1
|
+
{"version":3,"file":"auth-error-message-catalog.js","sourceRoot":"","sources":["../src/auth-error-message-catalog.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG;IAChB,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,yBAAyB;IACzB,iBAAiB;IACjB,WAAW;IACX,kBAAkB;IAClB,wBAAwB;IACxB,uBAAuB;IACvB,4BAA4B;IAC5B,yBAAyB;IACzB,6BAA6B;IAC7B,wBAAwB;IACxB,sBAAsB;IACtB,6BAA6B;CACO,CAAC;AAIvC,MAAM,CAAC,MAAM,qBAAqB,GAA4C;IAC5E,OAAO,EAAE,2BAA2B;IACpC,WAAW,EAAE,wCAAwC;IACrD,gBAAgB,EAAE,kCAAkC;IACpD,uBAAuB,EAAE,wCAAwC;IACjE,eAAe,EACb,iGAAiG;IACnG,SAAS,EACP,gHAAgH;IAClH,gBAAgB,EAAE,iCAAiC;IACnD,sBAAsB,EACpB,+DAA+D;IACjE,qBAAqB,EACnB,wEAAwE;IAC1E,0BAA0B,EACxB,4DAA4D;IAC9D,uBAAuB,EACrB,wHAAwH;IAC1H,2BAA2B,EACzB,qFAAqF;IACvF,sBAAsB,EACpB,oGAAoG;IACtG,oBAAoB,EAClB,6HAA6H;IAC/H,2BAA2B,EACzB,mFAAmF;CACtF,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,OAAO,SAAS,CAAC,QAAQ,CAAC,EAA8C,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -45,6 +45,12 @@ export declare const challengeExpiredAuthenticateResultSchema: z.ZodObject<{
|
|
|
45
45
|
message: z.ZodString;
|
|
46
46
|
}, z.core.$strict>;
|
|
47
47
|
export type ChallengeExpiredAuthenticateResult = z.infer<typeof challengeExpiredAuthenticateResultSchema>;
|
|
48
|
+
export declare const emailVerificationRequiredAuthenticateResultSchema: z.ZodObject<{
|
|
49
|
+
kind: z.ZodLiteral<"email_verification_required">;
|
|
50
|
+
success: z.ZodBoolean;
|
|
51
|
+
message: z.ZodString;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
export type EmailVerificationRequiredAuthenticateResult = z.infer<typeof emailVerificationRequiredAuthenticateResultSchema>;
|
|
48
54
|
export declare const authenticateResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
55
|
kind: z.ZodLiteral<"authenticated">;
|
|
50
56
|
success: z.ZodBoolean;
|
|
@@ -73,5 +79,9 @@ export declare const authenticateResultSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
73
79
|
kind: z.ZodLiteral<"challenge_expired">;
|
|
74
80
|
success: z.ZodBoolean;
|
|
75
81
|
message: z.ZodString;
|
|
82
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
83
|
+
kind: z.ZodLiteral<"email_verification_required">;
|
|
84
|
+
success: z.ZodBoolean;
|
|
85
|
+
message: z.ZodString;
|
|
76
86
|
}, z.core.$strict>], "kind">;
|
|
77
87
|
export type AuthenticateResult = z.infer<typeof authenticateResultSchema>;
|
|
@@ -76,10 +76,28 @@ export const challengeExpiredAuthenticateResultSchema = z
|
|
|
76
76
|
message: z.string(),
|
|
77
77
|
})
|
|
78
78
|
.strict();
|
|
79
|
+
// Returned by /api/auth/login, /api/auth/register and /api/auth/mfa/verify
|
|
80
|
+
// (HTTP 200) when the credentials were accepted but the flow was started by
|
|
81
|
+
// a THIRD-PARTY client app and the account's e-mail address is not verified
|
|
82
|
+
// yet (the `require_email_verification_for_third_party_apps` server
|
|
83
|
+
// setting). The auth server's own session cookie IS set — the user is signed
|
|
84
|
+
// in to the auth server — but no authorization code is minted for the
|
|
85
|
+
// requesting app: the client must send the user to the auth server's
|
|
86
|
+
// "verify your email to continue" page, which resumes the flow once the
|
|
87
|
+
// address is verified. Never returned for the auth server's own /account
|
|
88
|
+
// flow, which stays open to unverified accounts.
|
|
89
|
+
export const emailVerificationRequiredAuthenticateResultSchema = z
|
|
90
|
+
.object({
|
|
91
|
+
kind: z.literal("email_verification_required"),
|
|
92
|
+
success: z.boolean(),
|
|
93
|
+
message: z.string(),
|
|
94
|
+
})
|
|
95
|
+
.strict();
|
|
79
96
|
export const authenticateResultSchema = z.discriminatedUnion("kind", [
|
|
80
97
|
authenticatedAuthenticateResultSchema,
|
|
81
98
|
mfaRequiredAuthenticateResultSchema,
|
|
82
99
|
authenticateFailureResultSchema,
|
|
83
100
|
challengeExpiredAuthenticateResultSchema,
|
|
101
|
+
emailVerificationRequiredAuthenticateResultSchema,
|
|
84
102
|
]);
|
|
85
103
|
//# sourceMappingURL=authenticate_result.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate_result.js","sourceRoot":"","sources":["../src/authenticate_result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MA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EAAqE;AACrE,wEAAwE;AACxE,yEAAyE;AACzE,iDAAiD;AACjD,MAAM,CAAC,MAAM,iDAAiD,GAAG,CAAC;KAC/D,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,6BAA6B,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC;KACD,MAAM,EAAE,CAAC;AAMZ,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACnE,qCAAqC;IACrC,mCAAmC;IACnC,+BAA+B;IAC/B,wCAAwC;IACxC,iDAAiD;CAClD,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,12 +14,12 @@ export type * from "./pkce";
|
|
|
14
14
|
export * from "./oidc";
|
|
15
15
|
export type * from "./oidc";
|
|
16
16
|
export { sha256_base64url } from "./sha256_digest";
|
|
17
|
-
export { authenticateResultSchema, authenticatedAuthenticateResultSchema, mfaRequiredAuthenticateResultSchema, authenticateFailureResultSchema, challengeExpiredAuthenticateResultSchema, availableMfaFactorSchema, collapseWebauthnFactors, type AuthenticateResult, type AuthenticatedAuthenticateResult, type MfaRequiredAuthenticateResult, type AuthenticateFailureResult, type ChallengeExpiredAuthenticateResult, type AvailableMfaFactor, } from "./authenticate_result";
|
|
17
|
+
export { authenticateResultSchema, authenticatedAuthenticateResultSchema, mfaRequiredAuthenticateResultSchema, authenticateFailureResultSchema, challengeExpiredAuthenticateResultSchema, emailVerificationRequiredAuthenticateResultSchema, availableMfaFactorSchema, collapseWebauthnFactors, type AuthenticateResult, type AuthenticatedAuthenticateResult, type MfaRequiredAuthenticateResult, type AuthenticateFailureResult, type ChallengeExpiredAuthenticateResult, type EmailVerificationRequiredAuthenticateResult, type AvailableMfaFactor, } from "./authenticate_result";
|
|
18
18
|
export * from "./mfa";
|
|
19
19
|
export { createRequestTokensResultSchema, type RequestTokensResult, createSuccessfullyGeneratedTokensRecordSchema, type SuccessfullyGeneratedTokensRecord, } from "./request_tokens_result";
|
|
20
20
|
export { getAuthServerUrl } from "@schemavaults/app-definitions";
|
|
21
21
|
export { appIdSchema } from "@schemavaults/app-definitions";
|
|
22
|
-
export { createAudienceSchema, createAudienceListSchema, } from "./audience-schema";
|
|
22
|
+
export { createAudienceSchema, createAudienceListSchema, createResourceUrlAudienceSchema, isResourceUrlAudience, RESOURCE_URL_AUDIENCE_MAX_LENGTH, } from "./audience-schema";
|
|
23
23
|
export type { AudienceSchemaOverrides } from "./audience-schema";
|
|
24
24
|
export { inviteCodeFormatSchema, inviteCodeDefinitionSchema, } from "./invite-code";
|
|
25
25
|
export type { InviteCode, InviteCodeDefinition } from "./invite-code";
|
package/dist/index.js
CHANGED
|
@@ -8,12 +8,12 @@ export * from "./middleware";
|
|
|
8
8
|
export * from "./pkce";
|
|
9
9
|
export * from "./oidc";
|
|
10
10
|
export { sha256_base64url } from "./sha256_digest";
|
|
11
|
-
export { authenticateResultSchema, authenticatedAuthenticateResultSchema, mfaRequiredAuthenticateResultSchema, authenticateFailureResultSchema, challengeExpiredAuthenticateResultSchema, availableMfaFactorSchema, collapseWebauthnFactors, } from "./authenticate_result";
|
|
11
|
+
export { authenticateResultSchema, authenticatedAuthenticateResultSchema, mfaRequiredAuthenticateResultSchema, authenticateFailureResultSchema, challengeExpiredAuthenticateResultSchema, emailVerificationRequiredAuthenticateResultSchema, availableMfaFactorSchema, collapseWebauthnFactors, } from "./authenticate_result";
|
|
12
12
|
export * from "./mfa";
|
|
13
13
|
export { createRequestTokensResultSchema, createSuccessfullyGeneratedTokensRecordSchema, } from "./request_tokens_result";
|
|
14
14
|
export { getAuthServerUrl } from "@schemavaults/app-definitions";
|
|
15
15
|
export { appIdSchema } from "@schemavaults/app-definitions";
|
|
16
|
-
export { createAudienceSchema, createAudienceListSchema, } from "./audience-schema";
|
|
16
|
+
export { createAudienceSchema, createAudienceListSchema, createResourceUrlAudienceSchema, isResourceUrlAudience, RESOURCE_URL_AUDIENCE_MAX_LENGTH, } from "./audience-schema";
|
|
17
17
|
export { inviteCodeFormatSchema, inviteCodeDefinitionSchema, } from "./invite-code";
|
|
18
18
|
export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, organizationDefinitionSchema, getHardcodedOrgs, getAuthServerOwnerOrganizationId, DEFAULT_AUTH_SERVER_OWNER_ORGANIZATION_ID, getAuthServerOwnerOrganizationName, DEFAULT_AUTH_SERVER_OWNER_ORGANIZATION_NAME, MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, inviteMemberInputModes, inviteMemberFormSchema, organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, organizationMembershipRoleTypes, organizationMembershipRoleTypeSchema, isValidOrganizationMembershipRoleType, organizationMembershipRoleDetailsSchema, isValidOrganizationMembershipRoleDetails, } from "./organizations";
|
|
19
19
|
export { MaximumBrowserCookieSize } from "./MaximumBrowserCookieSize";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,GACf,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACL,mCAAmC,EACnC,qCAAqC,GACtC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,cAAc,EAEd,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,8BAA8B,EAC9B,yBAAyB,GAK1B,MAAM,aAAa,CAAC;AAErB,cAAc,eAAe,CAAC;AAG9B,mBAAmB;AACnB,cAAc,cAAc,CAAC;AAM7B,cAAc,cAAc,CAAC;AAG7B,cAAc,QAAQ,CAAC;AAGvB,cAAc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(RFC 7591) wire contract and
|
|
3
|
+
* request parsing, shared by the auth server's `POST /api/oidc/register`
|
|
4
|
+
* endpoint and `@schemavaults/auth-client-sdk`'s `registerDynamicClient()`
|
|
5
|
+
* helper.
|
|
6
|
+
*
|
|
7
|
+
* The parser here is pure: it validates and normalizes a registration
|
|
8
|
+
* request body against the platform's capabilities (authorization code
|
|
9
|
+
* flow with PKCE, optional client secret, redirect URI policy) and reports
|
|
10
|
+
* the RFC 7591 §3.2.2 error codes. Persisting the client, generating its
|
|
11
|
+
* id/secret and enforcing the deployment's settings is the server's job.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
import { type DynamicClientGrantType, type DynamicClientResponseType, type DynamicClientTokenEndpointAuthMethod } from "@schemavaults/app-definitions";
|
|
15
|
+
/** RFC 7591 §3.2.2 error codes the registration endpoint emits. */
|
|
16
|
+
export declare const DYNAMIC_CLIENT_REGISTRATION_ERRORS: readonly ["invalid_redirect_uri", "invalid_client_metadata"];
|
|
17
|
+
export type DynamicClientRegistrationErrorCode = (typeof DYNAMIC_CLIENT_REGISTRATION_ERRORS)[number];
|
|
18
|
+
export declare const dynamicClientRegistrationErrorSchema: z.ZodObject<{
|
|
19
|
+
error: z.ZodEnum<{
|
|
20
|
+
invalid_redirect_uri: "invalid_redirect_uri";
|
|
21
|
+
invalid_client_metadata: "invalid_client_metadata";
|
|
22
|
+
}>;
|
|
23
|
+
error_description: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type DynamicClientRegistrationError = {
|
|
26
|
+
error: DynamicClientRegistrationErrorCode;
|
|
27
|
+
error_description: string;
|
|
28
|
+
};
|
|
29
|
+
/** Mirrors the per-app callback URL cap enforced by the auth server. */
|
|
30
|
+
export declare const DYNAMIC_CLIENT_MAX_REDIRECT_URIS: 50;
|
|
31
|
+
/**
|
|
32
|
+
* Metadata fields (RFC 7591 §2) the platform cannot honour. A request
|
|
33
|
+
* carrying any of them is rejected with `invalid_client_metadata` rather
|
|
34
|
+
* than silently registering a client that will not behave as it asked:
|
|
35
|
+
* asymmetric client authentication (`jwks`, `jwks_uri`) is not
|
|
36
|
+
* implemented at the token endpoint, and software statements
|
|
37
|
+
* (`software_statement`) have no trusted issuers.
|
|
38
|
+
*/
|
|
39
|
+
export declare const DYNAMIC_CLIENT_UNSUPPORTED_METADATA_FIELDS: readonly ["jwks", "jwks_uri", "software_statement"];
|
|
40
|
+
/**
|
|
41
|
+
* The RFC 7591 §2 request body as the endpoint accepts it. Unknown
|
|
42
|
+
* members are ignored per §2 ("the authorization server MUST ignore any
|
|
43
|
+
* client metadata sent by the client that it does not understand").
|
|
44
|
+
*/
|
|
45
|
+
export type DynamicClientRegistrationRequest = {
|
|
46
|
+
redirect_uris: string[];
|
|
47
|
+
client_name?: string;
|
|
48
|
+
token_endpoint_auth_method?: DynamicClientTokenEndpointAuthMethod;
|
|
49
|
+
grant_types?: DynamicClientGrantType[];
|
|
50
|
+
response_types?: DynamicClientResponseType[];
|
|
51
|
+
client_uri?: string;
|
|
52
|
+
logo_uri?: string;
|
|
53
|
+
tos_uri?: string;
|
|
54
|
+
policy_uri?: string;
|
|
55
|
+
contacts?: string[];
|
|
56
|
+
scope?: string;
|
|
57
|
+
software_id?: string;
|
|
58
|
+
software_version?: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The normalized metadata a valid request resolves to: every optional
|
|
62
|
+
* member defaulted per RFC 7591 §2, `client_name` always present.
|
|
63
|
+
*/
|
|
64
|
+
export interface ParsedDynamicClientMetadata {
|
|
65
|
+
redirect_uris: readonly string[];
|
|
66
|
+
client_name: string;
|
|
67
|
+
token_endpoint_auth_method: DynamicClientTokenEndpointAuthMethod;
|
|
68
|
+
grant_types: readonly DynamicClientGrantType[];
|
|
69
|
+
response_types: readonly DynamicClientResponseType[];
|
|
70
|
+
client_uri: string | null;
|
|
71
|
+
logo_uri: string | null;
|
|
72
|
+
tos_uri: string | null;
|
|
73
|
+
policy_uri: string | null;
|
|
74
|
+
contacts: readonly string[] | null;
|
|
75
|
+
scope: string | null;
|
|
76
|
+
software_id: string | null;
|
|
77
|
+
software_version: string | null;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* RFC 7591 §3.2.1 registration response: the issued client identifier
|
|
81
|
+
* (and secret, for confidential clients) plus every registered metadata
|
|
82
|
+
* value as the server understood it. `client_secret_expires_at` is `0`
|
|
83
|
+
* because issued secrets do not expire.
|
|
84
|
+
*/
|
|
85
|
+
export declare const dynamicClientRegistrationResponseSchema: z.ZodObject<{
|
|
86
|
+
client_id: z.ZodString;
|
|
87
|
+
client_secret: z.ZodOptional<z.ZodString>;
|
|
88
|
+
client_id_issued_at: z.ZodNumber;
|
|
89
|
+
client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
redirect_uris: z.ZodArray<z.ZodString>;
|
|
91
|
+
client_name: z.ZodString;
|
|
92
|
+
token_endpoint_auth_method: z.ZodEnum<{
|
|
93
|
+
none: "none";
|
|
94
|
+
client_secret_basic: "client_secret_basic";
|
|
95
|
+
client_secret_post: "client_secret_post";
|
|
96
|
+
}>;
|
|
97
|
+
grant_types: z.ZodArray<z.ZodEnum<{
|
|
98
|
+
authorization_code: "authorization_code";
|
|
99
|
+
refresh_token: "refresh_token";
|
|
100
|
+
}>>;
|
|
101
|
+
response_types: z.ZodArray<z.ZodEnum<{
|
|
102
|
+
code: "code";
|
|
103
|
+
}>>;
|
|
104
|
+
client_uri: z.ZodOptional<z.ZodString>;
|
|
105
|
+
logo_uri: z.ZodOptional<z.ZodString>;
|
|
106
|
+
tos_uri: z.ZodOptional<z.ZodString>;
|
|
107
|
+
policy_uri: z.ZodOptional<z.ZodString>;
|
|
108
|
+
contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
109
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
110
|
+
software_id: z.ZodOptional<z.ZodString>;
|
|
111
|
+
software_version: z.ZodOptional<z.ZodString>;
|
|
112
|
+
}, z.core.$loose>;
|
|
113
|
+
export type DynamicClientRegistrationResponse = z.infer<typeof dynamicClientRegistrationResponseSchema>;
|
|
114
|
+
export interface ParseDynamicClientRegistrationRequestOptions {
|
|
115
|
+
/**
|
|
116
|
+
* Whether `http://localhost[:port]/...` redirect URIs are accepted. RFC
|
|
117
|
+
* 8252 §7.3 only sanctions the loopback IP literals, but many native and
|
|
118
|
+
* MCP clients still use the `localhost` name. Unlike the IP literals, a
|
|
119
|
+
* registered `localhost` URI matches its port exactly.
|
|
120
|
+
*/
|
|
121
|
+
allow_localhost_redirect_uris: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Whether private-use URI scheme redirect URIs (`com.example.app:/cb`,
|
|
124
|
+
* `vscode://...`) are accepted (RFC 8252 §7.1).
|
|
125
|
+
*/
|
|
126
|
+
allow_custom_scheme_redirect_uris: boolean;
|
|
127
|
+
}
|
|
128
|
+
export type ParseDynamicClientRegistrationRequestResult = {
|
|
129
|
+
ok: true;
|
|
130
|
+
metadata: ParsedDynamicClientMetadata;
|
|
131
|
+
} | {
|
|
132
|
+
ok: false;
|
|
133
|
+
error: DynamicClientRegistrationError;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* How a redirect URI is classified by the registration policy.
|
|
137
|
+
*/
|
|
138
|
+
export type DynamicClientRedirectUriKind = "https" | "http-loopback" | "http-localhost" | "http-other" | "custom-scheme" | "forbidden-scheme" | "invalid";
|
|
139
|
+
/**
|
|
140
|
+
* @description Classifies a candidate redirect URI (RFC 6749 §3.1.2 /
|
|
141
|
+
* RFC 8252 §7) without applying any deployment policy.
|
|
142
|
+
*/
|
|
143
|
+
export declare function classifyDynamicClientRedirectUri(value: unknown): DynamicClientRedirectUriKind;
|
|
144
|
+
/**
|
|
145
|
+
* @description Display name for a client that registered without a
|
|
146
|
+
* `client_name`: the host of its first redirect URI, or the URI's scheme
|
|
147
|
+
* for private-use schemes without a host.
|
|
148
|
+
*/
|
|
149
|
+
export declare function deriveDynamicClientNameFromRedirectUri(redirect_uri: string): string;
|
|
150
|
+
/**
|
|
151
|
+
* @description Parses and validates an RFC 7591 registration request body.
|
|
152
|
+
*
|
|
153
|
+
* - `redirect_uris` is REQUIRED (the platform only supports redirect-based
|
|
154
|
+
* grants), deduplicated, capped at {@link DYNAMIC_CLIENT_MAX_REDIRECT_URIS},
|
|
155
|
+
* and every entry must be `https`, an `http` loopback-IP URI, or — when
|
|
156
|
+
* the deployment allows them — an `http://localhost` URI or a private-use
|
|
157
|
+
* scheme URI. Violations are `invalid_redirect_uri`.
|
|
158
|
+
* - `token_endpoint_auth_method` defaults to `client_secret_basic` (RFC 7591
|
|
159
|
+
* §2); `grant_types` to `["authorization_code"]`; `response_types` to
|
|
160
|
+
* `["code"]`. Values outside the platform's support are
|
|
161
|
+
* `invalid_client_metadata`, as are the fields listed in
|
|
162
|
+
* {@link DYNAMIC_CLIENT_UNSUPPORTED_METADATA_FIELDS}.
|
|
163
|
+
* - `client_name` is trimmed and must fit {@link APP_NAME_MAX_LENGTH}; when
|
|
164
|
+
* absent it is derived from the first redirect URI.
|
|
165
|
+
* - Unknown members are ignored.
|
|
166
|
+
*/
|
|
167
|
+
export declare function parseDynamicClientRegistrationRequest(body: unknown, options: ParseDynamicClientRegistrationRequestOptions): ParseDynamicClientRegistrationRequestResult;
|
|
168
|
+
export default parseDynamicClientRegistrationRequest;
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth 2.0 Dynamic Client Registration (RFC 7591) wire contract and
|
|
3
|
+
* request parsing, shared by the auth server's `POST /api/oidc/register`
|
|
4
|
+
* endpoint and `@schemavaults/auth-client-sdk`'s `registerDynamicClient()`
|
|
5
|
+
* helper.
|
|
6
|
+
*
|
|
7
|
+
* The parser here is pure: it validates and normalizes a registration
|
|
8
|
+
* request body against the platform's capabilities (authorization code
|
|
9
|
+
* flow with PKCE, optional client secret, redirect URI policy) and reports
|
|
10
|
+
* the RFC 7591 §3.2.2 error codes. Persisting the client, generating its
|
|
11
|
+
* id/secret and enforcing the deployment's settings is the server's job.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
import { APP_CALLBACK_URL_MAX_LENGTH, APP_NAME_MAX_LENGTH, DYNAMIC_CLIENT_CONTACT_MAX_LENGTH, DYNAMIC_CLIENT_GRANT_TYPES, DYNAMIC_CLIENT_MAX_CONTACTS, DYNAMIC_CLIENT_METADATA_URI_MAX_LENGTH, DYNAMIC_CLIENT_RESPONSE_TYPES, DYNAMIC_CLIENT_SCOPE_MAX_LENGTH, DYNAMIC_CLIENT_SOFTWARE_FIELD_MAX_LENGTH, DYNAMIC_CLIENT_TOKEN_ENDPOINT_AUTH_METHODS, dynamicClientGrantTypeSchema, dynamicClientResponseTypeSchema, dynamicClientTokenEndpointAuthMethodSchema, } from "@schemavaults/app-definitions";
|
|
15
|
+
import { OIDC_SCOPE_REGEX } from "./scope";
|
|
16
|
+
/** RFC 7591 §3.2.2 error codes the registration endpoint emits. */
|
|
17
|
+
export const DYNAMIC_CLIENT_REGISTRATION_ERRORS = [
|
|
18
|
+
"invalid_redirect_uri",
|
|
19
|
+
"invalid_client_metadata",
|
|
20
|
+
];
|
|
21
|
+
export const dynamicClientRegistrationErrorSchema = z.object({
|
|
22
|
+
error: z.enum(DYNAMIC_CLIENT_REGISTRATION_ERRORS),
|
|
23
|
+
error_description: z.string().optional(),
|
|
24
|
+
});
|
|
25
|
+
/** Mirrors the per-app callback URL cap enforced by the auth server. */
|
|
26
|
+
export const DYNAMIC_CLIENT_MAX_REDIRECT_URIS = 50;
|
|
27
|
+
/**
|
|
28
|
+
* Metadata fields (RFC 7591 §2) the platform cannot honour. A request
|
|
29
|
+
* carrying any of them is rejected with `invalid_client_metadata` rather
|
|
30
|
+
* than silently registering a client that will not behave as it asked:
|
|
31
|
+
* asymmetric client authentication (`jwks`, `jwks_uri`) is not
|
|
32
|
+
* implemented at the token endpoint, and software statements
|
|
33
|
+
* (`software_statement`) have no trusted issuers.
|
|
34
|
+
*/
|
|
35
|
+
export const DYNAMIC_CLIENT_UNSUPPORTED_METADATA_FIELDS = [
|
|
36
|
+
"jwks",
|
|
37
|
+
"jwks_uri",
|
|
38
|
+
"software_statement",
|
|
39
|
+
];
|
|
40
|
+
/**
|
|
41
|
+
* RFC 7591 §3.2.1 registration response: the issued client identifier
|
|
42
|
+
* (and secret, for confidential clients) plus every registered metadata
|
|
43
|
+
* value as the server understood it. `client_secret_expires_at` is `0`
|
|
44
|
+
* because issued secrets do not expire.
|
|
45
|
+
*/
|
|
46
|
+
export const dynamicClientRegistrationResponseSchema = z
|
|
47
|
+
.object({
|
|
48
|
+
client_id: z.string().min(1),
|
|
49
|
+
client_secret: z.string().min(1).optional(),
|
|
50
|
+
client_id_issued_at: z.number().int().nonnegative(),
|
|
51
|
+
client_secret_expires_at: z.number().int().nonnegative().optional(),
|
|
52
|
+
redirect_uris: z.array(z.string()).min(1),
|
|
53
|
+
client_name: z.string(),
|
|
54
|
+
token_endpoint_auth_method: dynamicClientTokenEndpointAuthMethodSchema,
|
|
55
|
+
grant_types: z.array(dynamicClientGrantTypeSchema),
|
|
56
|
+
response_types: z.array(dynamicClientResponseTypeSchema),
|
|
57
|
+
client_uri: z.string().optional(),
|
|
58
|
+
logo_uri: z.string().optional(),
|
|
59
|
+
tos_uri: z.string().optional(),
|
|
60
|
+
policy_uri: z.string().optional(),
|
|
61
|
+
contacts: z.array(z.string()).optional(),
|
|
62
|
+
scope: z.string().optional(),
|
|
63
|
+
software_id: z.string().optional(),
|
|
64
|
+
software_version: z.string().optional(),
|
|
65
|
+
})
|
|
66
|
+
.loose();
|
|
67
|
+
/**
|
|
68
|
+
* Schemes that are never acceptable as a redirect target, whatever the
|
|
69
|
+
* deployment's policy: they either execute in the browser or are not
|
|
70
|
+
* application-controlled.
|
|
71
|
+
*/
|
|
72
|
+
const FORBIDDEN_REDIRECT_SCHEMES = new Set([
|
|
73
|
+
"javascript",
|
|
74
|
+
"data",
|
|
75
|
+
"blob",
|
|
76
|
+
"file",
|
|
77
|
+
"about",
|
|
78
|
+
"ftp",
|
|
79
|
+
"ws",
|
|
80
|
+
"wss",
|
|
81
|
+
"mailto",
|
|
82
|
+
]);
|
|
83
|
+
function isLoopbackHostname(hostname) {
|
|
84
|
+
// URL.hostname keeps the brackets on IPv6 literals.
|
|
85
|
+
return hostname === "127.0.0.1" || hostname === "[::1]";
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @description Classifies a candidate redirect URI (RFC 6749 §3.1.2 /
|
|
89
|
+
* RFC 8252 §7) without applying any deployment policy.
|
|
90
|
+
*/
|
|
91
|
+
export function classifyDynamicClientRedirectUri(value) {
|
|
92
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
93
|
+
return "invalid";
|
|
94
|
+
}
|
|
95
|
+
if (value.length > APP_CALLBACK_URL_MAX_LENGTH) {
|
|
96
|
+
return "invalid";
|
|
97
|
+
}
|
|
98
|
+
// RFC 6749 §3.1.2: the redirection endpoint URI MUST NOT include a
|
|
99
|
+
// fragment component.
|
|
100
|
+
if (value.includes("#")) {
|
|
101
|
+
return "invalid";
|
|
102
|
+
}
|
|
103
|
+
let url;
|
|
104
|
+
try {
|
|
105
|
+
url = new URL(value);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return "invalid";
|
|
109
|
+
}
|
|
110
|
+
const scheme = url.protocol.replace(/:$/, "").toLowerCase();
|
|
111
|
+
if (scheme === "https") {
|
|
112
|
+
return "https";
|
|
113
|
+
}
|
|
114
|
+
if (scheme === "http") {
|
|
115
|
+
if (isLoopbackHostname(url.hostname)) {
|
|
116
|
+
return "http-loopback";
|
|
117
|
+
}
|
|
118
|
+
if (url.hostname === "localhost") {
|
|
119
|
+
return "http-localhost";
|
|
120
|
+
}
|
|
121
|
+
return "http-other";
|
|
122
|
+
}
|
|
123
|
+
if (FORBIDDEN_REDIRECT_SCHEMES.has(scheme)) {
|
|
124
|
+
return "forbidden-scheme";
|
|
125
|
+
}
|
|
126
|
+
return "custom-scheme";
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @description Display name for a client that registered without a
|
|
130
|
+
* `client_name`: the host of its first redirect URI, or the URI's scheme
|
|
131
|
+
* for private-use schemes without a host.
|
|
132
|
+
*/
|
|
133
|
+
export function deriveDynamicClientNameFromRedirectUri(redirect_uri) {
|
|
134
|
+
try {
|
|
135
|
+
const url = new URL(redirect_uri);
|
|
136
|
+
const host = url.host;
|
|
137
|
+
if (host.length > 0) {
|
|
138
|
+
return host.slice(0, APP_NAME_MAX_LENGTH);
|
|
139
|
+
}
|
|
140
|
+
const scheme = url.protocol.replace(/:$/, "");
|
|
141
|
+
return (scheme.length > 0 ? scheme : "Dynamically registered client").slice(0, APP_NAME_MAX_LENGTH);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return "Dynamically registered client";
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const optionalMetadataUriSchema = z
|
|
148
|
+
.url({ protocol: /^https?$/ })
|
|
149
|
+
.max(DYNAMIC_CLIENT_METADATA_URI_MAX_LENGTH);
|
|
150
|
+
const optionalSoftwareFieldSchema = z
|
|
151
|
+
.string()
|
|
152
|
+
.max(DYNAMIC_CLIENT_SOFTWARE_FIELD_MAX_LENGTH);
|
|
153
|
+
/**
|
|
154
|
+
* Loose structural schema for the request body: only the members the
|
|
155
|
+
* platform reads, each validated for type/bounds; everything else is
|
|
156
|
+
* dropped. Semantic policy (allowed values, redirect URI classes) is
|
|
157
|
+
* applied afterwards so that every failure maps onto the right RFC 7591
|
|
158
|
+
* error code with a useful description.
|
|
159
|
+
*/
|
|
160
|
+
const requestBodyShapeSchema = z
|
|
161
|
+
.object({
|
|
162
|
+
redirect_uris: z.array(z.string()).optional(),
|
|
163
|
+
client_name: z.string().optional(),
|
|
164
|
+
token_endpoint_auth_method: z.string().optional(),
|
|
165
|
+
grant_types: z.array(z.string()).optional(),
|
|
166
|
+
response_types: z.array(z.string()).optional(),
|
|
167
|
+
client_uri: optionalMetadataUriSchema.optional(),
|
|
168
|
+
logo_uri: optionalMetadataUriSchema.optional(),
|
|
169
|
+
tos_uri: optionalMetadataUriSchema.optional(),
|
|
170
|
+
policy_uri: optionalMetadataUriSchema.optional(),
|
|
171
|
+
contacts: z
|
|
172
|
+
.array(z.string().min(1).max(DYNAMIC_CLIENT_CONTACT_MAX_LENGTH))
|
|
173
|
+
.max(DYNAMIC_CLIENT_MAX_CONTACTS)
|
|
174
|
+
.optional(),
|
|
175
|
+
scope: z.string().max(DYNAMIC_CLIENT_SCOPE_MAX_LENGTH).optional(),
|
|
176
|
+
software_id: optionalSoftwareFieldSchema.optional(),
|
|
177
|
+
software_version: optionalSoftwareFieldSchema.optional(),
|
|
178
|
+
})
|
|
179
|
+
.loose();
|
|
180
|
+
function metadataError(error_description) {
|
|
181
|
+
return {
|
|
182
|
+
ok: false,
|
|
183
|
+
error: { error: "invalid_client_metadata", error_description },
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function redirectUriError(error_description) {
|
|
187
|
+
return {
|
|
188
|
+
ok: false,
|
|
189
|
+
error: { error: "invalid_redirect_uri", error_description },
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function describeFirstIssue(error) {
|
|
193
|
+
const issue = error.issues[0];
|
|
194
|
+
if (!issue) {
|
|
195
|
+
return "Malformed client metadata.";
|
|
196
|
+
}
|
|
197
|
+
const path = issue.path.map((p) => String(p)).join(".");
|
|
198
|
+
return path.length > 0 ? `'${path}': ${issue.message}` : issue.message;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* @description Parses and validates an RFC 7591 registration request body.
|
|
202
|
+
*
|
|
203
|
+
* - `redirect_uris` is REQUIRED (the platform only supports redirect-based
|
|
204
|
+
* grants), deduplicated, capped at {@link DYNAMIC_CLIENT_MAX_REDIRECT_URIS},
|
|
205
|
+
* and every entry must be `https`, an `http` loopback-IP URI, or — when
|
|
206
|
+
* the deployment allows them — an `http://localhost` URI or a private-use
|
|
207
|
+
* scheme URI. Violations are `invalid_redirect_uri`.
|
|
208
|
+
* - `token_endpoint_auth_method` defaults to `client_secret_basic` (RFC 7591
|
|
209
|
+
* §2); `grant_types` to `["authorization_code"]`; `response_types` to
|
|
210
|
+
* `["code"]`. Values outside the platform's support are
|
|
211
|
+
* `invalid_client_metadata`, as are the fields listed in
|
|
212
|
+
* {@link DYNAMIC_CLIENT_UNSUPPORTED_METADATA_FIELDS}.
|
|
213
|
+
* - `client_name` is trimmed and must fit {@link APP_NAME_MAX_LENGTH}; when
|
|
214
|
+
* absent it is derived from the first redirect URI.
|
|
215
|
+
* - Unknown members are ignored.
|
|
216
|
+
*/
|
|
217
|
+
export function parseDynamicClientRegistrationRequest(body, options) {
|
|
218
|
+
if (typeof body !== "object" || body === null || Array.isArray(body)) {
|
|
219
|
+
return metadataError("The request body must be a JSON object.");
|
|
220
|
+
}
|
|
221
|
+
for (const field of DYNAMIC_CLIENT_UNSUPPORTED_METADATA_FIELDS) {
|
|
222
|
+
if (field in body && body[field] !== undefined) {
|
|
223
|
+
return metadataError(`'${field}' is not supported by this authorization server.`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const shape = requestBodyShapeSchema.safeParse(body);
|
|
227
|
+
if (!shape.success) {
|
|
228
|
+
return metadataError(describeFirstIssue(shape.error));
|
|
229
|
+
}
|
|
230
|
+
const raw = shape.data;
|
|
231
|
+
// --- redirect_uris -----------------------------------------------------
|
|
232
|
+
if (!raw.redirect_uris || raw.redirect_uris.length === 0) {
|
|
233
|
+
return redirectUriError("'redirect_uris' is required and must contain at least one URI.");
|
|
234
|
+
}
|
|
235
|
+
const redirect_uris = [...new Set(raw.redirect_uris)];
|
|
236
|
+
if (redirect_uris.length > DYNAMIC_CLIENT_MAX_REDIRECT_URIS) {
|
|
237
|
+
return redirectUriError(`'redirect_uris' may contain at most ${DYNAMIC_CLIENT_MAX_REDIRECT_URIS} URIs.`);
|
|
238
|
+
}
|
|
239
|
+
for (const uri of redirect_uris) {
|
|
240
|
+
switch (classifyDynamicClientRedirectUri(uri)) {
|
|
241
|
+
case "https":
|
|
242
|
+
case "http-loopback":
|
|
243
|
+
break;
|
|
244
|
+
case "http-localhost":
|
|
245
|
+
if (!options.allow_localhost_redirect_uris) {
|
|
246
|
+
return redirectUriError(`Redirect URI '${uri}' uses http://localhost, which this authorization server does not accept; use the loopback IP literal (http://127.0.0.1 or http://[::1]) instead.`);
|
|
247
|
+
}
|
|
248
|
+
break;
|
|
249
|
+
case "http-other":
|
|
250
|
+
return redirectUriError(`Redirect URI '${uri}' must use https (plain http is only accepted for loopback addresses).`);
|
|
251
|
+
case "custom-scheme":
|
|
252
|
+
if (!options.allow_custom_scheme_redirect_uris) {
|
|
253
|
+
return redirectUriError(`Redirect URI '${uri}' uses a private-use scheme, which this authorization server does not accept.`);
|
|
254
|
+
}
|
|
255
|
+
break;
|
|
256
|
+
case "forbidden-scheme":
|
|
257
|
+
return redirectUriError(`Redirect URI '${uri}' uses a scheme that can never be a redirect target.`);
|
|
258
|
+
case "invalid":
|
|
259
|
+
default:
|
|
260
|
+
return redirectUriError(`Redirect URI '${uri}' is not an absolute URI without a fragment (max ${APP_CALLBACK_URL_MAX_LENGTH} characters).`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
// --- client_name -------------------------------------------------------
|
|
264
|
+
let client_name;
|
|
265
|
+
if (typeof raw.client_name === "string") {
|
|
266
|
+
const trimmed = raw.client_name.trim();
|
|
267
|
+
if (trimmed.length === 0) {
|
|
268
|
+
return metadataError("'client_name' must not be blank.");
|
|
269
|
+
}
|
|
270
|
+
if (trimmed.length > APP_NAME_MAX_LENGTH) {
|
|
271
|
+
return metadataError(`'client_name' may be at most ${APP_NAME_MAX_LENGTH} characters.`);
|
|
272
|
+
}
|
|
273
|
+
client_name = trimmed;
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
client_name = deriveDynamicClientNameFromRedirectUri(redirect_uris[0]);
|
|
277
|
+
}
|
|
278
|
+
// --- token_endpoint_auth_method ---------------------------------------
|
|
279
|
+
let token_endpoint_auth_method;
|
|
280
|
+
if (typeof raw.token_endpoint_auth_method === "string") {
|
|
281
|
+
const parsed = dynamicClientTokenEndpointAuthMethodSchema.safeParse(raw.token_endpoint_auth_method);
|
|
282
|
+
if (!parsed.success) {
|
|
283
|
+
return metadataError(`'token_endpoint_auth_method' must be one of: ${DYNAMIC_CLIENT_TOKEN_ENDPOINT_AUTH_METHODS.join(", ")}.`);
|
|
284
|
+
}
|
|
285
|
+
token_endpoint_auth_method = parsed.data;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
// RFC 7591 §2: "If unspecified or omitted, the default is
|
|
289
|
+
// client_secret_basic".
|
|
290
|
+
token_endpoint_auth_method = "client_secret_basic";
|
|
291
|
+
}
|
|
292
|
+
// --- grant_types / response_types -------------------------------------
|
|
293
|
+
let grant_types;
|
|
294
|
+
if (raw.grant_types) {
|
|
295
|
+
if (raw.grant_types.length === 0) {
|
|
296
|
+
return metadataError("'grant_types' must not be empty.");
|
|
297
|
+
}
|
|
298
|
+
const parsed = z.array(dynamicClientGrantTypeSchema).safeParse(raw.grant_types);
|
|
299
|
+
if (!parsed.success) {
|
|
300
|
+
return metadataError(`'grant_types' may only contain: ${DYNAMIC_CLIENT_GRANT_TYPES.join(", ")}.`);
|
|
301
|
+
}
|
|
302
|
+
grant_types = [...new Set(parsed.data)];
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
grant_types = ["authorization_code"];
|
|
306
|
+
}
|
|
307
|
+
let response_types;
|
|
308
|
+
if (raw.response_types) {
|
|
309
|
+
if (raw.response_types.length === 0) {
|
|
310
|
+
return metadataError("'response_types' must not be empty.");
|
|
311
|
+
}
|
|
312
|
+
const parsed = z
|
|
313
|
+
.array(dynamicClientResponseTypeSchema)
|
|
314
|
+
.safeParse(raw.response_types);
|
|
315
|
+
if (!parsed.success) {
|
|
316
|
+
return metadataError(`'response_types' may only contain: ${DYNAMIC_CLIENT_RESPONSE_TYPES.join(", ")}.`);
|
|
317
|
+
}
|
|
318
|
+
response_types = [...new Set(parsed.data)];
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
response_types = ["code"];
|
|
322
|
+
}
|
|
323
|
+
// RFC 7591 §2.1: `code` requires the authorization_code grant.
|
|
324
|
+
if (!grant_types.includes("authorization_code")) {
|
|
325
|
+
return metadataError("'grant_types' must include 'authorization_code' (the only way this authorization server issues tokens to dynamically registered clients).");
|
|
326
|
+
}
|
|
327
|
+
// --- scope -------------------------------------------------------------
|
|
328
|
+
let scope = null;
|
|
329
|
+
if (typeof raw.scope === "string") {
|
|
330
|
+
if (raw.scope.length > 0 && !OIDC_SCOPE_REGEX.test(raw.scope)) {
|
|
331
|
+
return metadataError("'scope' must be a space-separated list of scope tokens (RFC 6749 §3.3).");
|
|
332
|
+
}
|
|
333
|
+
scope = raw.scope.length > 0 ? raw.scope : null;
|
|
334
|
+
}
|
|
335
|
+
return {
|
|
336
|
+
ok: true,
|
|
337
|
+
metadata: {
|
|
338
|
+
redirect_uris,
|
|
339
|
+
client_name,
|
|
340
|
+
token_endpoint_auth_method,
|
|
341
|
+
grant_types,
|
|
342
|
+
response_types,
|
|
343
|
+
client_uri: raw.client_uri ?? null,
|
|
344
|
+
logo_uri: raw.logo_uri ?? null,
|
|
345
|
+
tos_uri: raw.tos_uri ?? null,
|
|
346
|
+
policy_uri: raw.policy_uri ?? null,
|
|
347
|
+
contacts: raw.contacts ? [...raw.contacts] : null,
|
|
348
|
+
scope,
|
|
349
|
+
software_id: raw.software_id ?? null,
|
|
350
|
+
software_version: raw.software_version ?? null,
|
|
351
|
+
},
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
export default parseDynamicClientRegistrationRequest;
|
|
355
|
+
//# sourceMappingURL=dynamic-client-registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-client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R,QAAQ,EAAE;YACR,aAAa;YACb,WAAW;YACX,0BAA0B;YAC1B,WAAW;YACX,cAAc;YACd,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI,IAAI;YAClC,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,IAAI;YAC9B,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,IAAI;YAC5B,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI,IAAI;YAClC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI;YACjD,KAAK;YACL,WAAW,EAAE,GAAG,CAAC,WAAW,IAAI,IAAI;YACpC,gBAAgB,EAAE,GAAG,CAAC,gBAAgB,IAAI,IAAI;SAC/C;KACF,CAAC;AACJ,CAAC;AAED,eAAe,qCAAqC,CAAC"}
|
package/dist/oidc/endpoints.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare const OIDC_ENDPOINT_PATHS: {
|
|
|
20
20
|
readonly userinfo: "/api/oidc/userinfo";
|
|
21
21
|
readonly introspection: "/api/oidc/introspect";
|
|
22
22
|
readonly jwks: "/api/oidc/jwks";
|
|
23
|
+
readonly registration: "/api/oidc/register";
|
|
23
24
|
};
|
|
24
25
|
export type OidcEndpointName = keyof typeof OIDC_ENDPOINT_PATHS;
|
|
25
26
|
/**
|
package/dist/oidc/endpoints.js
CHANGED
|
@@ -20,6 +20,9 @@ export const OIDC_ENDPOINT_PATHS = {
|
|
|
20
20
|
userinfo: "/api/oidc/userinfo",
|
|
21
21
|
introspection: "/api/oidc/introspect",
|
|
22
22
|
jwks: "/api/oidc/jwks",
|
|
23
|
+
// RFC 7591 dynamic client registration; advertised in the discovery
|
|
24
|
+
// document only when the server setting enabling it is on.
|
|
25
|
+
registration: "/api/oidc/register",
|
|
23
26
|
};
|
|
24
27
|
/**
|
|
25
28
|
* Resolves an OIDC endpoint to its absolute URL for the given issuer.
|
|
@@ -1 +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;
|
|
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;IACtB,oEAAoE;IACpE,2DAA2D;IAC3D,YAAY,EAAE,oBAAoB;CACa,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
|
@@ -10,4 +10,6 @@ export type { OidcEndpointName } from "./endpoints";
|
|
|
10
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
11
|
export type { OidcRefreshTokenDeliveryMode, OidcTokenResponseExtensions, } from "./token-endpoint-extensions";
|
|
12
12
|
export { buildOidcProviderMetadata } from "./provider-metadata";
|
|
13
|
-
export type { OidcProviderMetadata } from "./provider-metadata";
|
|
13
|
+
export type { OidcProviderMetadata, BuildOidcProviderMetadataOptions, } from "./provider-metadata";
|
|
14
|
+
export { DYNAMIC_CLIENT_REGISTRATION_ERRORS, DYNAMIC_CLIENT_MAX_REDIRECT_URIS, DYNAMIC_CLIENT_UNSUPPORTED_METADATA_FIELDS, dynamicClientRegistrationErrorSchema, dynamicClientRegistrationResponseSchema, parseDynamicClientRegistrationRequest, classifyDynamicClientRedirectUri, deriveDynamicClientNameFromRedirectUri, } from "./dynamic-client-registration";
|
|
15
|
+
export type { DynamicClientRegistrationError, DynamicClientRegistrationErrorCode, DynamicClientRegistrationRequest, DynamicClientRegistrationResponse, ParsedDynamicClientMetadata, ParseDynamicClientRegistrationRequestOptions, ParseDynamicClientRegistrationRequestResult, DynamicClientRedirectUriKind, } from "./dynamic-client-registration";
|
package/dist/oidc/index.js
CHANGED
|
@@ -5,4 +5,5 @@ export { buildOidcProfileClaims } from "./profile-claims";
|
|
|
5
5
|
export { OIDC_ENDPOINT_PATHS, getOidcEndpointUrl } from "./endpoints";
|
|
6
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
7
|
export { buildOidcProviderMetadata } from "./provider-metadata";
|
|
8
|
+
export { DYNAMIC_CLIENT_REGISTRATION_ERRORS, DYNAMIC_CLIENT_MAX_REDIRECT_URIS, DYNAMIC_CLIENT_UNSUPPORTED_METADATA_FIELDS, dynamicClientRegistrationErrorSchema, dynamicClientRegistrationResponseSchema, parseDynamicClientRegistrationRequest, classifyDynamicClientRedirectUri, deriveDynamicClientNameFromRedirectUri, } from "./dynamic-client-registration";
|
|
8
9
|
//# 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,EACnB,yBAAyB,GAC1B,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"}
|
|
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,EACnB,yBAAyB,GAC1B,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;AAMhE,OAAO,EACL,kCAAkC,EAClC,gCAAgC,EAChC,0CAA0C,EAC1C,oCAAoC,EACpC,uCAAuC,EACvC,qCAAqC,EACrC,gCAAgC,EAChC,sCAAsC,GACvC,MAAM,+BAA+B,CAAC"}
|
|
@@ -41,11 +41,28 @@ export type OidcProviderMetadata = {
|
|
|
41
41
|
authorization_response_iss_parameter_supported: boolean;
|
|
42
42
|
request_parameter_supported: boolean;
|
|
43
43
|
request_uri_parameter_supported: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* RFC 7591 §3 / RFC 8414 §2 dynamic client registration endpoint.
|
|
46
|
+
* Present only when the deployment has enabled dynamic client
|
|
47
|
+
* registration (the `allow_dynamic_client_registration` server
|
|
48
|
+
* setting); absent otherwise, so clients do not attempt registrations
|
|
49
|
+
* the endpoint would refuse.
|
|
50
|
+
*/
|
|
51
|
+
registration_endpoint?: string;
|
|
44
52
|
};
|
|
53
|
+
export interface BuildOidcProviderMetadataOptions {
|
|
54
|
+
/**
|
|
55
|
+
* Whether to advertise the RFC 7591 `registration_endpoint`. The auth
|
|
56
|
+
* server passes the value of its `allow_dynamic_client_registration`
|
|
57
|
+
* setting; the client SDK, which builds the metadata statically, leaves
|
|
58
|
+
* it out (it never needs to register a client to redeem tokens).
|
|
59
|
+
*/
|
|
60
|
+
registration_endpoint?: boolean;
|
|
61
|
+
}
|
|
45
62
|
/**
|
|
46
63
|
* Builds the provider metadata for the auth server at `issuer`. A
|
|
47
64
|
* trailing slash on `issuer` is stripped so the endpoints and the
|
|
48
65
|
* `issuer` field stay consistent with the `iss` claim.
|
|
49
66
|
*/
|
|
50
|
-
export declare function buildOidcProviderMetadata(issuer: string): OidcProviderMetadata;
|
|
67
|
+
export declare function buildOidcProviderMetadata(issuer: string, options?: BuildOidcProviderMetadataOptions): OidcProviderMetadata;
|
|
51
68
|
export default buildOidcProviderMetadata;
|
|
@@ -21,7 +21,7 @@ import { OIDC_SUPPORTED_SCOPES } from "./scope";
|
|
|
21
21
|
* trailing slash on `issuer` is stripped so the endpoints and the
|
|
22
22
|
* `issuer` field stay consistent with the `iss` claim.
|
|
23
23
|
*/
|
|
24
|
-
export function buildOidcProviderMetadata(issuer) {
|
|
24
|
+
export function buildOidcProviderMetadata(issuer, options = {}) {
|
|
25
25
|
if (typeof issuer !== "string" || issuer.length === 0) {
|
|
26
26
|
throw new TypeError("Expected 'issuer' to be a non-empty string!");
|
|
27
27
|
}
|
|
@@ -95,6 +95,11 @@ export function buildOidcProviderMetadata(issuer) {
|
|
|
95
95
|
// out would falsely advertise support.
|
|
96
96
|
request_parameter_supported: false,
|
|
97
97
|
request_uri_parameter_supported: false,
|
|
98
|
+
...(options.registration_endpoint === true
|
|
99
|
+
? {
|
|
100
|
+
registration_endpoint: getOidcEndpointUrl(normalized_issuer, "registration"),
|
|
101
|
+
}
|
|
102
|
+
: {}),
|
|
98
103
|
};
|
|
99
104
|
}
|
|
100
105
|
export default buildOidcProviderMetadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-metadata.js","sourceRoot":"","sources":["../../src/oidc/provider-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"provider-metadata.js","sourceRoot":"","sources":["../../src/oidc/provider-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAiDhD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAAc,EACd,UAA4C,EAAE;IAE9C,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,iBAAiB,GAAW,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QACpD,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACrB,CAAC,CAAC,MAAM,CAAC;IAEX,OAAO;QACL,MAAM,EAAE,iBAAiB;QACzB,sBAAsB,EAAE,kBAAkB,CAAC,iBAAiB,EAAE,eAAe,CAAC;QAC9E,cAAc,EAAE,kBAAkB,CAAC,iBAAiB,EAAE,OAAO,CAAC;QAC9D,i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IAAI;YACxC,CAAC,CAAC;gBACE,qBAAqB,EAAE,kBAAkB,CACvC,iBAAiB,EACjB,cAAc,CACf;aACF;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import type { z as zod } from "zod";
|
|
|
2
2
|
import { type AudienceSchemaOverrides } from "./audience-schema";
|
|
3
3
|
import { type SchemaVaultsAppEnvironment } from "@schemavaults/app-definitions";
|
|
4
4
|
export declare function createSuccessfullyGeneratedTokensRecordSchema(z: typeof zod, environment?: SchemaVaultsAppEnvironment, overrides?: AudienceSchemaOverrides): zod.ZodObject<{
|
|
5
|
-
access: zod.ZodOptional<zod.ZodRecord<zod.ZodUnion<readonly [zod.ZodURL & zod.ZodType<string, string, zod.core.$ZodTypeInternals<string, string>>, zod.ZodString]>, zod.ZodUnion<readonly [zod.ZodObject<{
|
|
5
|
+
access: zod.ZodOptional<zod.ZodRecord<zod.ZodUnion<readonly [zod.ZodURL & zod.ZodType<string, string, zod.core.$ZodTypeInternals<string, string>>, zod.ZodString, zod.ZodURL]>, zod.ZodUnion<readonly [zod.ZodObject<{
|
|
6
6
|
uid: zod.ZodNonOptional<zod.ZodString>;
|
|
7
7
|
iat: zod.ZodNonOptional<zod.ZodNumber>;
|
|
8
8
|
exp: zod.ZodNonOptional<zod.ZodNumber>;
|
|
@@ -33,7 +33,7 @@ export declare function createRequestTokensResultSchema(z: typeof zod, environme
|
|
|
33
33
|
message: zod.ZodNonOptional<zod.ZodString>;
|
|
34
34
|
client_app_id: zod.ZodNonOptional<zod.ZodString>;
|
|
35
35
|
tokens: zod.ZodOptional<zod.ZodObject<{
|
|
36
|
-
access: zod.ZodOptional<zod.ZodRecord<zod.ZodUnion<readonly [zod.ZodURL & zod.ZodType<string, string, zod.core.$ZodTypeInternals<string, string>>, zod.ZodString]>, zod.ZodUnion<readonly [zod.ZodObject<{
|
|
36
|
+
access: zod.ZodOptional<zod.ZodRecord<zod.ZodUnion<readonly [zod.ZodURL & zod.ZodType<string, string, zod.core.$ZodTypeInternals<string, string>>, zod.ZodString, zod.ZodURL]>, zod.ZodUnion<readonly [zod.ZodObject<{
|
|
37
37
|
uid: zod.ZodNonOptional<zod.ZodString>;
|
|
38
38
|
iat: zod.ZodNonOptional<zod.ZodNumber>;
|
|
39
39
|
exp: zod.ZodNonOptional<zod.ZodNumber>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schemavaults/auth-common",
|
|
3
3
|
"description": "Types and utility functions for authentication and authorization",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.29.0",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"types": "dist/index.d.ts",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"zod": "4.4.3",
|
|
17
|
-
"@schemavaults/app-definitions": "0.
|
|
17
|
+
"@schemavaults/app-definitions": "0.14.0",
|
|
18
18
|
"crypto-js": "4.2.0"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|