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