openid-client 4.9.1 → 5.1.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/README.md CHANGED
@@ -14,8 +14,6 @@ openid-client.
14
14
  - Implicit Flow
15
15
  - Hybrid Flow
16
16
  - UserInfo Request
17
- - Fetching Distributed Claims
18
- - Unpacking Aggregated Claims
19
17
  - Offline Access / Refresh Token Grant
20
18
  - Client Credentials Grant
21
19
  - Client Authentication
@@ -25,7 +23,7 @@ openid-client.
25
23
  - client_secret_jwt
26
24
  - private_key_jwt
27
25
  - Consuming Self-Issued OpenID Provider ID Token response
28
- - [RFC8414 - OAuth 2.0 Authorization Server Metadata][feature-oauth-discovery] and [OpenID Connect Discovery 1.0][feature-discovery]
26
+ - [OpenID Connect Discovery 1.0][feature-discovery]
29
27
  - Discovery of OpenID Provider (Issuer) Metadata
30
28
  - Discovery of OpenID Provider (Issuer) Metadata via user provided inputs (via [webfinger][documentation-webfinger])
31
29
  - [OpenID Connect Dynamic Client Registration 1.0][feature-registration]
@@ -44,13 +42,13 @@ openid-client.
44
42
  - self_signed_tls_client_auth
45
43
  - [RFC9101 - OAuth 2.0 JWT-Secured Authorization Request (JAR)][feature-jar]
46
44
  - [RFC9126 - OAuth 2.0 Pushed Authorization Requests (PAR)][feature-par]
47
- - [OpenID Connect Session Management 1.0 - draft 28][feature-rp-logout]
48
- - RP-Initiated Logout
49
- - [Financial-grade API - Part 2: Read and Write API Security Profile (FAPI) - ID2][feature-fapi]
45
+ - [OpenID Connect RP-Initiated Logout 1.0 - draft 01][feature-rp-logout]
46
+ - [Financial-grade API Security Profile 1.0 - Part 2: Advanced (FAPI)][feature-fapi]
50
47
  - [JWT Secured Authorization Response Mode for OAuth 2.0 (JARM) - ID1][feature-jarm]
51
- - [OAuth 2.0 Demonstration of Proof-of-Possession at the Application Layer (DPoP) - draft 03][feature-dpop]
48
+ - [OAuth 2.0 Demonstration of Proof-of-Possession at the Application Layer (DPoP) - draft 04][feature-dpop]
49
+ - [OAuth 2.0 Authorization Server Issuer Identification - draft-04][feature-iss]
52
50
 
53
- Updates to draft specifications (DPoP, JARM, and FAPI) are released as MINOR library versions,
51
+ Updates to draft specifications (DPoP, JARM, etc) are released as MINOR library versions,
54
52
  if you utilize these specification implementations consider using the tilde `~` operator in your
55
53
  package.json since breaking changes may be introduced as part of these version updates.
56
54
 
@@ -59,13 +57,12 @@ package.json since breaking changes may be introduced as part of these version u
59
57
  Filip Skokan has [certified][openid-certified-link] that [openid-client][npm-url]
60
58
  conforms to the following profiles of the OpenID Connect™ protocol
61
59
 
62
- - RP Basic, Implicit, Hybrid, Config, Dynamic, and Form Post
63
- - RP FAPI R/W MTLS and Private Key
64
-
60
+ - Basic, Implicit, Hybrid, Config, Dynamic, and Form Post RP
61
+ - FAPI 1.0 Advanced RP
65
62
 
66
63
  ## Sponsor
67
64
 
68
- [<img width="65" height="65" align="left" src="https://avatars.githubusercontent.com/u/2824157?s=75&v=4" alt="auth0-logo">][sponsor-auth0] If you want to quickly add OpenID Connect authentication to Node.js apps, feel free to check out Auth0's Node.js SDK and free plan at [auth0.com/developers][sponsor-auth0].<br><br>
65
+ [<img height="65" align="left" src="https://cdn.auth0.com/blog/github-sponsorships/brand-evolution-logo-Auth0-horizontal-Indigo.png" alt="auth0-logo">][sponsor-auth0] If you want to quickly add OpenID Connect authentication to Node.js apps, feel free to check out Auth0's Node.js SDK and free plan. [Create an Auth0 account; it's free!][sponsor-auth0]<br><br>
69
66
 
70
67
  ## Support
71
68
 
@@ -76,8 +73,8 @@ If you or your business use openid-client, please consider becoming a [sponsor][
76
73
 
77
74
  The library exposes what are essentially steps necessary to be done by a relying party consuming
78
75
  OpenID Connect Authorization Server responses or wrappers around requests to its endpoints. Aside
79
- from a generic OpenID Connect [passport][passport-url] strategy it does not expose neither express
80
- or koa middlewares. Those can however be built using the exposed API.
76
+ from a generic OpenID Connect [passport][passport-url] strategy it does not expose any framework
77
+ specific middlewares. Those can however be built using the exposed API, one such example is [express-openid-connect][]
81
78
 
82
79
  - [openid-client API Documentation][documentation]
83
80
  - [Issuer][documentation-issuer]
@@ -90,7 +87,9 @@ or koa middlewares. Those can however be built using the exposed API.
90
87
 
91
88
  ## Install
92
89
 
93
- Node.js version **>=12.0.0** is recommended, but **^10.19.0** lts/dubnium is also supported.
90
+ Node.js LTS releases Codename Erbium (starting with ^12.19.0) and newer LTS releases are supported.
91
+ This means ^12.19.0 (Erbium), ^14.15.0 (Fermium), and ^16.13.0 (Gallium). Future LTS releases will
92
+ be added to this list as they're released.
94
93
 
95
94
  ```console
96
95
  npm install openid-client
@@ -100,11 +99,10 @@ npm install openid-client
100
99
 
101
100
  Discover an Issuer configuration using its published .well-known endpoints
102
101
  ```js
103
- const { Issuer } = require('openid-client');
104
- Issuer.discover('https://accounts.google.com') // => Promise
105
- .then(function (googleIssuer) {
106
- console.log('Discovered issuer %s %O', googleIssuer.issuer, googleIssuer.metadata);
107
- });
102
+ import { Issuer } from 'openid-client';
103
+
104
+ const googleIssuer = await Issuer.discover('https://accounts.google.com');
105
+ console.log('Discovered issuer %s %O', googleIssuer.issuer, googleIssuer.metadata);
108
106
  ```
109
107
 
110
108
  ### Authorization Code Flow
@@ -116,7 +114,7 @@ PKCE instead of `state` parameter for CSRF protection.
116
114
  Create a Client instance for that issuer's authorization server intended for Authorization Code
117
115
  flow.
118
116
 
119
- **See the [documentation][documentation] for full API details.**
117
+ **See the [documentation][] for full API details.**
120
118
 
121
119
  ```js
122
120
  const client = new googleIssuer.Client({
@@ -135,7 +133,7 @@ to get the authorization endpoint's URL with parameters already encoded in the q
135
133
  to.
136
134
 
137
135
  ```js
138
- const { generators } = require('openid-client');
136
+ import { generators } from 'openid-client';
139
137
  const code_verifier = generators.codeVerifier();
140
138
  // store the code_verifier in your framework's session mechanism, if it is a cookie based solution
141
139
  // it should be httpOnly (not readable by javascript) and encrypted.
@@ -154,28 +152,22 @@ When end-users are redirected back to your `redirect_uri` your application consu
154
152
  passes in the `code_verifier` to include it in the authorization code grant token exchange.
155
153
  ```js
156
154
  const params = client.callbackParams(req);
157
- client.callback('https://client.example.com/callback', params, { code_verifier }) // => Promise
158
- .then(function (tokenSet) {
159
- console.log('received and validated tokens %j', tokenSet);
160
- console.log('validated ID Token claims %j', tokenSet.claims());
161
- });
155
+ const tokenSet = await client.callback('https://client.example.com/callback', params, { code_verifier });
156
+ console.log('received and validated tokens %j', tokenSet);
157
+ console.log('validated ID Token claims %j', tokenSet.claims());
162
158
  ```
163
159
 
164
160
  You can then call the `userinfo_endpoint`.
165
161
  ```js
166
- client.userinfo(access_token) // => Promise
167
- .then(function (userinfo) {
168
- console.log('userinfo %j', userinfo);
169
- });
162
+ const userinfo = await client.userinfo(access_token);
163
+ console.log('userinfo %j', userinfo);
170
164
  ```
171
165
 
172
166
  And later refresh the tokenSet if it had a `refresh_token`.
173
167
  ```js
174
- client.refresh(refresh_token) // => Promise
175
- .then(function (tokenSet) {
176
- console.log('refreshed and validated tokens %j', tokenSet);
177
- console.log('refreshed ID Token claims %j', tokenSet.claims());
178
- });
168
+ const tokenSet = await client.refresh(refresh_token);
169
+ console.log('refreshed and validated tokens %j', tokenSet);
170
+ console.log('refreshed ID Token claims %j', tokenSet.claims());
179
171
  ```
180
172
 
181
173
  ### Implicit ID Token Flow
@@ -186,7 +178,7 @@ with no need for accessing any third party APIs with an Access Token from the Au
186
178
 
187
179
  Create a Client instance for that issuer's authorization server intended for ID Token implicit flow.
188
180
 
189
- **See the [documentation][documentation] for full API details.**
181
+ **See the [documentation][] for full API details.**
190
182
  ```js
191
183
  const client = new googleIssuer.Client({
192
184
  client_id: 'zELcpfANLqY7Oqas',
@@ -202,7 +194,7 @@ to get the authorization endpoint's URL with parameters already encoded in the q
202
194
  to.
203
195
 
204
196
  ```js
205
- const { generators } = require('openid-client');
197
+ import { generators } from 'openid-client';
206
198
  const nonce = generators.nonce();
207
199
  // store the nonce in your framework's session mechanism, if it is a cookie based solution
208
200
  // it should be httpOnly (not readable by javascript) and encrypted.
@@ -220,11 +212,9 @@ ID Token verification steps.
220
212
  ```js
221
213
  // assumes req.body is populated from your web framework's body parser
222
214
  const params = client.callbackParams(req);
223
- client.callback('https://client.example.com/callback', params, { nonce }) // => Promise
224
- .then(function (tokenSet) {
225
- console.log('received and validated tokens %j', tokenSet);
226
- console.log('validated ID Token claims %j', tokenSet.claims());
227
- });
215
+ const tokenSet = await client.callback('https://client.example.com/callback', params, { nonce });
216
+ console.log('received and validated tokens %j', tokenSet);
217
+ console.log('validated ID Token claims %j', tokenSet.claims());
228
218
  ```
229
219
 
230
220
  ### Device Authorization Grant (Device Flow)
@@ -253,11 +243,6 @@ This will poll in the defined interval and only resolve with a TokenSet once one
253
243
  will handle the defined `authorization_pending` and `slow_down` "soft" errors and continue polling
254
244
  but upon any other error it will reject. With tokenSet received you can throw away the handle.
255
245
 
256
- ## Electron Support
257
-
258
- Electron >=v6.0.0 runtime is supported to the extent of the crypto engine BoringSSL feature parity
259
- with standard Node.js OpenSSL.
260
-
261
246
  ## FAQ
262
247
 
263
248
  #### Semver?
@@ -269,8 +254,8 @@ private API and is subject to change between any versions.
269
254
 
270
255
  #### How do I use it outside of Node.js
271
256
 
272
- It is **only built for ^10.19.0 || >=12.0.0 Node.js** environment - including openid-client in
273
- browser-environment targeted projects is not supported and may result in unexpected results.
257
+ It is **only built for Node.js** environments - including openid-client in
258
+ browser-environment targeted projects is not supported.
274
259
 
275
260
  #### How to make the client send client_id and client_secret in the body?
276
261
 
@@ -278,32 +263,28 @@ See [Client Authentication Methods (docs)][documentation-methods].
278
263
 
279
264
  #### Can I adjust the HTTP timeout?
280
265
 
281
- See [Customizing (docs)](https://github.com/panva/node-openid-client/blob/master/docs/README.md#customizing).
282
-
283
- #### How can I debug the requests and responses?
284
-
285
- See [Customizing (docs)](https://github.com/panva/node-openid-client/blob/master/docs/README.md#customizing).
266
+ See [Customizing (docs)][documentation-customizing].
286
267
 
287
268
 
288
269
  [openid-connect]: https://openid.net/connect/
289
270
  [feature-core]: https://openid.net/specs/openid-connect-core-1_0.html
290
271
  [feature-discovery]: https://openid.net/specs/openid-connect-discovery-1_0.html
291
- [feature-oauth-discovery]: https://tools.ietf.org/html/rfc8414
292
272
  [feature-registration]: https://openid.net/specs/openid-connect-registration-1_0.html
293
273
  [feature-revocation]: https://tools.ietf.org/html/rfc7009
294
274
  [feature-introspection]: https://tools.ietf.org/html/rfc7662
295
275
  [feature-mtls]: https://tools.ietf.org/html/rfc8705
296
276
  [feature-device-flow]: https://tools.ietf.org/html/rfc8628
297
- [feature-rp-logout]: https://openid.net/specs/openid-connect-session-1_0.html#RPLogout
277
+ [feature-rp-logout]: https://openid.net/specs/openid-connect-rpinitiated-1_0-01.html
298
278
  [feature-jarm]: https://openid.net/specs/openid-financial-api-jarm-ID1.html
299
- [feature-fapi]: https://openid.net/specs/openid-financial-api-part-2-ID2.html
300
- [feature-dpop]: https://tools.ietf.org/html/draft-ietf-oauth-dpop-03
279
+ [feature-fapi]: https://openid.net/specs/openid-financial-api-part-2-1_0.html
280
+ [feature-dpop]: https://tools.ietf.org/html/draft-ietf-oauth-dpop-04
301
281
  [feature-par]: https://www.rfc-editor.org/rfc/rfc9126.html
302
282
  [feature-jar]: https://www.rfc-editor.org/rfc/rfc9101.html
283
+ [feature-iss]: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-iss-auth-resp-04
303
284
  [openid-certified-link]: https://openid.net/certification/
304
285
  [passport-url]: http://passportjs.org
305
286
  [npm-url]: https://www.npmjs.com/package/openid-client
306
- [sponsor-auth0]: https://auth0.com/developers?utm_source=GHsponsor&utm_medium=GHsponsor&utm_campaign=openid-client&utm_content=auth
287
+ [sponsor-auth0]: https://a0.to/try-auth0
307
288
  [support-sponsor]: https://github.com/sponsors/panva
308
289
  [documentation]: https://github.com/panva/node-openid-client/blob/master/docs/README.md
309
290
  [documentation-issuer]: https://github.com/panva/node-openid-client/blob/master/docs/README.md#issuer
@@ -315,3 +296,4 @@ See [Customizing (docs)](https://github.com/panva/node-openid-client/blob/master
315
296
  [documentation-generators]: https://github.com/panva/node-openid-client/blob/master/docs/README.md#generators
316
297
  [documentation-methods]: https://github.com/panva/node-openid-client/blob/master/docs/README.md#client-authentication-methods
317
298
  [documentation-webfinger]: https://github.com/panva/node-openid-client/blob/master/docs/README.md#issuerwebfingerinput
299
+ [express-openid-connect]: https://www.npmjs.com/package/express-openid-connect