openid-client 4.7.0 → 4.7.4

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/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [4.7.4](https://github.com/panva/node-openid-client/compare/v4.7.3...v4.7.4) (2021-05-25)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **typescript:** add a missing PATCH method to requestResource ([6b2c3ce](https://github.com/panva/node-openid-client/commit/6b2c3ce09b45a301911fb9f8e1e52831063f7063)), closes [#368](https://github.com/panva/node-openid-client/issues/368)
11
+
12
+ ## [4.7.3](https://github.com/panva/node-openid-client/compare/v4.7.2...v4.7.3) (2021-04-30)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **fapi:** validate ID Token's iat regardless of which channel it came from ([b68b9ab](https://github.com/panva/node-openid-client/commit/b68b9ab5af6a85a2f42adf6b782cef7e08378658))
18
+
19
+ ## [4.7.2](https://github.com/panva/node-openid-client/compare/v4.7.1...v4.7.2) (2021-04-23)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **typescript:** add types for 4.6.0 additions ([9064136](https://github.com/panva/node-openid-client/commit/9064136d959b5825f69b32344bbe165f12a10949))
25
+
26
+ ## [4.7.1](https://github.com/panva/node-openid-client/compare/v4.7.0...v4.7.1) (2021-04-22)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * **typescript:** add types for 4.7.0 additions ([2c1d2ab](https://github.com/panva/node-openid-client/commit/2c1d2ab71fe2daba2dad23af1f92f66c92305df5))
32
+
5
33
  ## [4.7.0](https://github.com/panva/node-openid-client/compare/v4.6.0...v4.7.0) (2021-04-22)
6
34
 
7
35
 
package/lib/client.js CHANGED
@@ -724,6 +724,8 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
724
724
  });
725
725
  }
726
726
 
727
+ const fapi = this.constructor.name === 'FAPIClient';
728
+
727
729
  if (returnedBy === 'authorization') {
728
730
  if (!payload.at_hash && tokenSet.access_token) {
729
731
  throw new RPError({
@@ -739,19 +741,7 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
739
741
  });
740
742
  }
741
743
 
742
- const fapi = this.constructor.name === 'FAPIClient';
743
-
744
744
  if (fapi) {
745
- if (payload.iat < timestamp - 3600) {
746
- throw new RPError({
747
- printf: ['JWT issued too far in the past, now %i, iat %i', timestamp, payload.iat],
748
- now: timestamp,
749
- tolerance: this[CLOCK_TOLERANCE],
750
- iat: payload.iat,
751
- jwt: idToken,
752
- });
753
- }
754
-
755
745
  if (!payload.s_hash && (tokenSet.state || state)) {
756
746
  throw new RPError({
757
747
  message: 'missing required property s_hash',
@@ -773,6 +763,16 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
773
763
  }
774
764
  }
775
765
 
766
+ if (fapi && payload.iat < timestamp - 3600) {
767
+ throw new RPError({
768
+ printf: ['JWT issued too far in the past, now %i, iat %i', timestamp, payload.iat],
769
+ now: timestamp,
770
+ tolerance: this[CLOCK_TOLERANCE],
771
+ iat: payload.iat,
772
+ jwt: idToken,
773
+ });
774
+ }
775
+
776
776
  if (tokenSet.access_token && payload.at_hash !== undefined) {
777
777
  try {
778
778
  tokenHash.validate({ claim: 'at_hash', source: 'access_token' }, payload.at_hash, tokenSet.access_token, header.alg, key && key.crv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openid-client",
3
- "version": "4.7.0",
3
+ "version": "4.7.4",
4
4
  "description": "OpenID Connect Relying Party (RP, Client) implementation for Node.js runtime, supports passportjs",
5
5
  "keywords": [
6
6
  "auth",
package/types/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference lib="dom"/>
2
3
  // TypeScript Version: 3.6
3
4
 
4
5
  /**
@@ -324,6 +325,10 @@ export interface DeviceAuthorizationExtras {
324
325
  DPoP?: DPoPInput;
325
326
  }
326
327
 
328
+ export interface PushedAuthorizationRequestExtras {
329
+ clientAssertionPayload?: object;
330
+ }
331
+
327
332
  export type Address<ExtendedAddress extends {} = UnknownObject> = Override<
328
333
  {
329
334
  formatted?: string;
@@ -508,7 +513,7 @@ export class Client {
508
513
  options?: {
509
514
  headers?: object;
510
515
  body?: string | Buffer;
511
- method?: "GET" | "POST" | "PUT" | "HEAD" | "DELETE" | "OPTIONS" | "TRACE";
516
+ method?: "GET" | "POST" | "PUT" | "HEAD" | "DELETE" | "OPTIONS" | "TRACE" | "PATCH";
512
517
  tokenType?: string;
513
518
  DPoP?: DPoPInput;
514
519
  }
@@ -552,6 +557,14 @@ export class Client {
552
557
  parameters?: DeviceAuthorizationParameters,
553
558
  extras?: DeviceAuthorizationExtras
554
559
  ): Promise<DeviceFlowHandle<Client>>;
560
+ pushedAuthorizationRequest(
561
+ parameters?: AuthorizationParameters,
562
+ extras?: PushedAuthorizationRequestExtras,
563
+ ): Promise<{
564
+ request_uri: string;
565
+ expires_in: number;
566
+ [key: string]: unknown;
567
+ }>;
555
568
  static register(
556
569
  metadata: object,
557
570
  other?: RegisterOther & ClientOptions
@@ -567,9 +580,14 @@ export class Client {
567
580
  [key: string]: unknown;
568
581
  }
569
582
 
583
+ interface DeviceFlowPollOptions {
584
+ signal?: AbortSignal,
585
+ }
586
+
570
587
  export class DeviceFlowHandle<TClient extends Client> {
571
588
  // tslint:disable-line:no-unnecessary-generics
572
- poll(): Promise<TokenSet>;
589
+ poll(options?: DeviceFlowPollOptions): Promise<TokenSet>;
590
+ abort(): void;
573
591
  expired(): boolean;
574
592
  expires_at: number;
575
593
  client: TClient;