oauth4webapi 2.4.4 → 2.4.5
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 +1 -1
- package/build/index.d.ts +8 -10
- package/build/index.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ import * as oauth2 from 'oauth4webapi'
|
|
|
43
43
|
**`example`** Deno import
|
|
44
44
|
|
|
45
45
|
```js
|
|
46
|
-
import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.4.
|
|
46
|
+
import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.4.5/mod.ts'
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
- Authorization Code Flow - OpenID Connect [source](examples/code.ts), or plain OAuth 2 [source](examples/oauth.ts)
|
package/build/index.d.ts
CHANGED
|
@@ -127,9 +127,7 @@ export type ClientAuthenticationMethod = 'client_secret_basic' | 'client_secret_
|
|
|
127
127
|
* ```
|
|
128
128
|
*/
|
|
129
129
|
export type JWSAlgorithm = 'PS256' | 'ES256' | 'RS256' | 'EdDSA' | 'ES384' | 'PS384' | 'RS384' | 'ES512' | 'PS512' | 'RS512';
|
|
130
|
-
/** @ignore during Documentation generation but part of the public API */
|
|
131
130
|
export declare const clockSkew: unique symbol;
|
|
132
|
-
/** @ignore during Documentation generation but part of the public API */
|
|
133
131
|
export declare const clockTolerance: unique symbol;
|
|
134
132
|
/**
|
|
135
133
|
* Authorization Server Metadata
|
|
@@ -456,9 +454,9 @@ export interface Client {
|
|
|
456
454
|
* Use to adjust the client's assumed current time. Positive and negative finite values
|
|
457
455
|
* representing seconds are allowed. Default is `0` (Date.now() + 0 seconds is used).
|
|
458
456
|
*
|
|
459
|
-
* @
|
|
457
|
+
* @example
|
|
460
458
|
*
|
|
461
|
-
*
|
|
459
|
+
* When the client's local clock is mistakenly 1 hour in the past
|
|
462
460
|
*
|
|
463
461
|
* ```ts
|
|
464
462
|
* const client: oauth.Client = {
|
|
@@ -468,7 +466,9 @@ export interface Client {
|
|
|
468
466
|
* }
|
|
469
467
|
* ```
|
|
470
468
|
*
|
|
471
|
-
* @example
|
|
469
|
+
* @example
|
|
470
|
+
*
|
|
471
|
+
* When the client's local clock is mistakenly 1 hour in the future
|
|
472
472
|
*
|
|
473
473
|
* ```ts
|
|
474
474
|
* const client: oauth.Client = {
|
|
@@ -483,9 +483,9 @@ export interface Client {
|
|
|
483
483
|
* Use to set allowed client's clock tolerance when checking DateTime JWT Claims. Only positive
|
|
484
484
|
* finite values representing seconds are allowed. Default is `30` (30 seconds).
|
|
485
485
|
*
|
|
486
|
-
* @
|
|
486
|
+
* @example
|
|
487
487
|
*
|
|
488
|
-
*
|
|
488
|
+
* Tolerate 30 seconds clock skew when validating JWT claims like exp or nbf.
|
|
489
489
|
*
|
|
490
490
|
* ```ts
|
|
491
491
|
* const client: oauth.Client = {
|
|
@@ -747,10 +747,8 @@ export interface ProtectedResourceRequestOptions extends Omit<HttpRequestOptions
|
|
|
747
747
|
*
|
|
748
748
|
* This option only affects the request if the {@link ProtectedResourceRequestOptions.DPoP DPoP}
|
|
749
749
|
* option is also used.
|
|
750
|
-
*
|
|
751
|
-
* @ignore during Documentation generation but part of the public API
|
|
752
750
|
*/
|
|
753
|
-
clockSkew?: number;
|
|
751
|
+
[clockSkew]?: number;
|
|
754
752
|
}
|
|
755
753
|
/**
|
|
756
754
|
* Performs a protected resource request at an arbitrary URL.
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
let USER_AGENT;
|
|
2
2
|
if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
|
|
3
3
|
const NAME = 'oauth4webapi';
|
|
4
|
-
const VERSION = 'v2.4.
|
|
4
|
+
const VERSION = 'v2.4.5';
|
|
5
5
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
6
6
|
}
|
|
7
7
|
export const clockSkew = Symbol();
|
|
@@ -656,7 +656,7 @@ export async function protectedResourceRequest(accessToken, method, url, headers
|
|
|
656
656
|
headers.set('authorization', `Bearer ${accessToken}`);
|
|
657
657
|
}
|
|
658
658
|
else {
|
|
659
|
-
await dpopProofJwt(headers, options.DPoP, url, 'GET', getClockSkew({ [clockSkew]: options?.clockSkew }), accessToken);
|
|
659
|
+
await dpopProofJwt(headers, options.DPoP, url, 'GET', getClockSkew({ [clockSkew]: options?.[clockSkew] }), accessToken);
|
|
660
660
|
headers.set('authorization', `DPoP ${accessToken}`);
|
|
661
661
|
}
|
|
662
662
|
const request = new Request(url.href, {
|
|
@@ -685,7 +685,7 @@ export async function userInfoRequest(as, client, accessToken, options) {
|
|
|
685
685
|
}
|
|
686
686
|
return protectedResourceRequest(accessToken, 'GET', url, headers, null, {
|
|
687
687
|
...options,
|
|
688
|
-
clockSkew: getClockSkew(client),
|
|
688
|
+
[clockSkew]: getClockSkew(client),
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
691
|
let jwksCache;
|