Skip to content

Commit eef0d7d

Browse files
committed
feat: support for RFC-to-be 9728 - OAuth 2.0 Protected Resource Metadata
1 parent 545f9ea commit eef0d7d

25 files changed

+623
-73
lines changed

docs/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ Support from the community to continue maintaining and improving this module is
164164
- [processRefreshTokenResponse](functions/processRefreshTokenResponse.md)
165165
- [refreshTokenGrantRequest](functions/refreshTokenGrantRequest.md)
166166

167+
## Resource Server Metadata
168+
169+
- [ResourceServer](interfaces/ResourceServer.md)
170+
- [processResourceDiscoveryResponse](functions/processResourceDiscoveryResponse.md)
171+
- [resourceDiscoveryRequest](functions/resourceDiscoveryRequest.md)
172+
167173
## SAML 2.0 Bearer Assertion Grant Type
168174

169175
- [genericTokenEndpointRequest](functions/genericTokenEndpointRequest.md)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Function: processResourceDiscoveryResponse()
2+
3+
[💗 Help the project](https://github.com/sponsors/panva)
4+
5+
Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by [becoming a sponsor](https://github.com/sponsors/panva).
6+
7+
***
8+
9+
**processResourceDiscoveryResponse**(`expectedResourceIdentifier`, `response`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`ResourceServer`](../interfaces/ResourceServer.md)\>
10+
11+
Validates [Response](https://developer.mozilla.org/docs/Web/API/Response) instance to be one coming from the resource server's well-known
12+
discovery endpoint.
13+
14+
## Parameters
15+
16+
| Parameter | Type | Description |
17+
| ------ | ------ | ------ |
18+
| `expectedResourceIdentifier` | [`URL`](https://developer.mozilla.org/docs/Web/API/URL) | Expected Resource Identifier value. |
19+
| `response` | [`Response`](https://developer.mozilla.org/docs/Web/API/Response) | Resolved value from [resourceDiscoveryRequest](resourceDiscoveryRequest.md) or from a general [fetch](https://developer.mozilla.org/docs/Web/API/Window/fetch) following [WWWAuthenticateChallengeParameters.resource_metadata](../interfaces/WWWAuthenticateChallengeParameters.md#resource_metadata). |
20+
21+
## Returns
22+
23+
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`ResourceServer`](../interfaces/ResourceServer.md)\>
24+
25+
Resolves with the discovered Resource Server Metadata.
26+
27+
## See
28+
29+
[RFC-to-be 9728 - OAuth 2.0 Protected Resource Metadata](https://www.ietf.org/archive/id/draft-ietf-oauth-resource-metadata-13.html#name-protected-resource-metadata-r)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Function: resourceDiscoveryRequest()
2+
3+
[💗 Help the project](https://github.com/sponsors/panva)
4+
5+
Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by [becoming a sponsor](https://github.com/sponsors/panva).
6+
7+
***
8+
9+
**resourceDiscoveryRequest**(`resourceIdentifier`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Response`](https://developer.mozilla.org/docs/Web/API/Response)\>
10+
11+
Performs a protected resource metadata discovery.
12+
13+
## Parameters
14+
15+
| Parameter | Type | Description |
16+
| ------ | ------ | ------ |
17+
| `resourceIdentifier` | [`URL`](https://developer.mozilla.org/docs/Web/API/URL) | Protected resource's resource identifier to resolve the well-known discovery URI for |
18+
| `options`? | [`HttpRequestOptions`](../interfaces/HttpRequestOptions.md)\<`"GET"`, `undefined`\> | - |
19+
20+
## Returns
21+
22+
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Response`](https://developer.mozilla.org/docs/Web/API/Response)\>
23+
24+
Resolves with a [Response](https://developer.mozilla.org/docs/Web/API/Response) to then invoke [processResourceDiscoveryResponse](processResourceDiscoveryResponse.md)
25+
with
26+
27+
## See
28+
29+
[RFC-to-be 9728 - OAuth 2.0 Protected Resource Metadata](https://www.ietf.org/archive/id/draft-ietf-oauth-resource-metadata-13.html#name-protected-resource-metadata-)

docs/interfaces/ResourceServer.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Interface: ResourceServer
2+
3+
[💗 Help the project](https://github.com/sponsors/panva)
4+
5+
Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by [becoming a sponsor](https://github.com/sponsors/panva).
6+
7+
***
8+
9+
Protected Resource Server Metadata
10+
11+
## See
12+
13+
[IANA OAuth Protected Resource Server Metadata registry](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#protected-resource-server-metadata)
14+
15+
## Indexable
16+
17+
\[`metadata`: `string`\]: `undefined` \| [`JsonValue`](../type-aliases/JsonValue.md)
18+
19+
## Properties
20+
21+
### resource
22+
23+
`readonly` **resource**: `string`
24+
25+
Resource server's Resource Identifier URL.
26+
27+
***
28+
29+
### authorization\_details\_types\_supported?
30+
31+
`readonly` `optional` **authorization\_details\_types\_supported**: `boolean`
32+
33+
JSON array containing a list of the authorization details type values supported by the resource
34+
server when the authorization_details request parameter is used
35+
36+
***
37+
38+
### authorization\_servers?
39+
40+
`readonly` `optional` **authorization\_servers**: `string`[]
41+
42+
JSON array containing a list of OAuth authorization server issuer identifiers
43+
44+
***
45+
46+
### bearer\_methods\_supported?
47+
48+
`readonly` `optional` **bearer\_methods\_supported**: `string`[]
49+
50+
JSON array containing a list of the OAuth 2.0 Bearer Token presentation methods that this
51+
protected resource supports
52+
53+
***
54+
55+
### dpop\_bound\_access\_tokens\_required?
56+
57+
`readonly` `optional` **dpop\_bound\_access\_tokens\_required**: `boolean`
58+
59+
Boolean value specifying whether the protected resource always requires the use of DPoP-bound
60+
access tokens
61+
62+
***
63+
64+
### dpop\_signing\_alg\_values\_supported?
65+
66+
`readonly` `optional` **dpop\_signing\_alg\_values\_supported**: `boolean`
67+
68+
JSON array containing a list of the JWS alg values supported by the resource server for
69+
validating DPoP proof JWTs
70+
71+
***
72+
73+
### jwks\_uri?
74+
75+
`readonly` `optional` **jwks\_uri**: `string`
76+
77+
URL of the protected resource's JWK Set document
78+
79+
***
80+
81+
### resource\_documentation?
82+
83+
`readonly` `optional` **resource\_documentation**: `string`
84+
85+
URL of a page containing human-readable information that developers might want or need to know
86+
when using the protected resource
87+
88+
***
89+
90+
### resource\_name?
91+
92+
`readonly` `optional` **resource\_name**: `string`
93+
94+
Human-readable name of the protected resource
95+
96+
***
97+
98+
### resource\_policy\_uri?
99+
100+
`readonly` `optional` **resource\_policy\_uri**: `string`
101+
102+
URL of a page containing human-readable information about the protected resource's requirements
103+
on how the client can use the data provided by the protected resource
104+
105+
***
106+
107+
### resource\_signing\_alg\_values\_supported?
108+
109+
`readonly` `optional` **resource\_signing\_alg\_values\_supported**: `string`[]
110+
111+
JSON array containing a list of the JWS signing algorithms (alg values) supported by the
112+
protected resource for signed content
113+
114+
***
115+
116+
### resource\_tos\_uri?
117+
118+
`readonly` `optional` **resource\_tos\_uri**: `string`
119+
120+
URL of a page containing human-readable information about the protected resource's terms of
121+
service
122+
123+
***
124+
125+
### scopes\_supported?
126+
127+
`readonly` `optional` **scopes\_supported**: `string`[]
128+
129+
JSON array containing a list of the OAuth 2.0 scope values that are used in authorization
130+
requests to request access to this protected resource
131+
132+
***
133+
134+
### signed\_metadata?
135+
136+
`readonly` `optional` **signed\_metadata**: `string`
137+
138+
Signed JWT containing metadata parameters about the protected resource as claims
139+
140+
***
141+
142+
### tls\_client\_certificate\_bound\_access\_tokens?
143+
144+
`readonly` `optional` **tls\_client\_certificate\_bound\_access\_tokens**: `boolean`
145+
146+
Boolean value indicating protected resource support for mutual-TLS client certificate-bound
147+
access tokens

0 commit comments

Comments
 (0)