Skip to content

Commit b90d5ba

Browse files
author
itsuki
committed
add type and schema for protected resource metadata
1 parent 7473694 commit b90d5ba

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/shared/auth.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
import { z } from "zod";
22

3+
/**
4+
* RFC 8414 OAuth 2.0 Authorization Server Metadata
5+
*/
6+
export const OAuthProtectedResourceMetadataSchema = z
7+
.object({
8+
resource: z.string(),
9+
authorization_servers: z.array(z.string()).optional(),
10+
jwks_uri: z.string().optional(),
11+
scopes_supported: z.array(z.string()).optional(),
12+
bearer_methods_supported: z.array(z.string()).optional(),
13+
resource_signing_alg_values_supported: z.array(z.string()).optional(),
14+
resource_name: z.string().optional(),
15+
resource_documentation: z.string().optional(),
16+
resource_policy_uri: z.string().optional(),
17+
resource_tos_uri: z.string().optional(),
18+
tls_client_certificate_bound_access_tokens: z.boolean().optional(),
19+
authorization_details_types_supported: z.array(z.string()).optional(),
20+
dpop_signing_alg_values_supported: z.array(z.string()).optional(),
21+
dpop_bound_access_tokens_required: z.boolean().optional(),
22+
})
23+
.passthrough();
24+
325
/**
426
* RFC 8414 OAuth 2.0 Authorization Server Metadata
527
*/
@@ -109,6 +131,7 @@ export const OAuthTokenRevocationRequestSchema = z.object({
109131
token_type_hint: z.string().optional(),
110132
}).strip();
111133

134+
export type OAuthProtectedResourceMetadata = z.infer<typeof OAuthProtectedResourceMetadataSchema>;
112135
export type OAuthMetadata = z.infer<typeof OAuthMetadataSchema>;
113136
export type OAuthTokens = z.infer<typeof OAuthTokensSchema>;
114137
export type OAuthErrorResponse = z.infer<typeof OAuthErrorResponseSchema>;

0 commit comments

Comments
 (0)