@aws-sdk/middleware-token 3.972.10 → 3.972.12
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/dist-cjs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var protocols = require('@smithy/core/protocols');
|
|
4
4
|
var types = require('@smithy/types');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var client = require('@smithy/core/client');
|
|
6
|
+
var config = require('@smithy/core/config');
|
|
7
7
|
var tokenDefaultProvider = require('./tokenDefaultProvider');
|
|
8
8
|
|
|
9
9
|
const tokenMiddlewareOptions = {
|
|
@@ -14,7 +14,7 @@ const tokenMiddlewareOptions = {
|
|
|
14
14
|
override: true,
|
|
15
15
|
};
|
|
16
16
|
const tokenMiddleware = (options) => (next, context) => async (args) => {
|
|
17
|
-
if (!
|
|
17
|
+
if (!protocols.HttpRequest.isInstance(args.request) || context.currentAuthConfig)
|
|
18
18
|
return next(args);
|
|
19
19
|
const token = options.token && (await options.token());
|
|
20
20
|
if (token?.token) {
|
|
@@ -42,9 +42,9 @@ const isTokenWithExpiry = (token) => token.expiration !== undefined;
|
|
|
42
42
|
const isTokenExpiringWithinFiveMins = (token) => isTokenWithExpiry(token) && token.expiration.getTime() - Date.now() < 300000;
|
|
43
43
|
const normalizeTokenProvider = (token) => {
|
|
44
44
|
if (typeof token === "function") {
|
|
45
|
-
return
|
|
45
|
+
return config.memoize(token, isTokenExpiringWithinFiveMins, isTokenWithExpiry);
|
|
46
46
|
}
|
|
47
|
-
return
|
|
47
|
+
return client.normalizeProvider(token);
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
const resolveTokenConfig = (input) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { normalizeProvider } from "@smithy/core/client";
|
|
2
|
+
import { memoize } from "@smithy/core/config";
|
|
3
3
|
const isTokenWithExpiry = (token) => token.expiration !== undefined;
|
|
4
4
|
const isTokenExpiringWithinFiveMins = (token) => isTokenWithExpiry(token) && token.expiration.getTime() - Date.now() < 300000;
|
|
5
5
|
export const normalizeTokenProvider = (token) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-token",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.12",
|
|
4
4
|
"description": "Middleware and Plugin for setting token authentication",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -30,12 +30,10 @@
|
|
|
30
30
|
},
|
|
31
31
|
"license": "Apache-2.0",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@aws-sdk/token-providers": "3.
|
|
34
|
-
"@aws-sdk/types": "^3.973.
|
|
35
|
-
"@smithy/
|
|
36
|
-
"@smithy/
|
|
37
|
-
"@smithy/types": "^4.14.0",
|
|
38
|
-
"@smithy/util-middleware": "^4.2.13",
|
|
33
|
+
"@aws-sdk/token-providers": "3.1046.0",
|
|
34
|
+
"@aws-sdk/types": "^3.973.8",
|
|
35
|
+
"@smithy/core": "^3.24.1",
|
|
36
|
+
"@smithy/types": "^4.14.1",
|
|
39
37
|
"tslib": "^2.6.2"
|
|
40
38
|
},
|
|
41
39
|
"devDependencies": {
|