@aws-sdk/token-providers 3.204.0 → 3.209.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/dist-cjs/fromSso.js +4 -4
- package/dist-cjs/validateTokenKey.js +2 -2
- package/dist-cjs/writeSSOTokenToFile.js +2 -2
- package/dist-es/fromSso.js +4 -4
- package/dist-es/validateTokenKey.js +2 -2
- package/dist-es/writeSSOTokenToFile.js +2 -2
- package/dist-types/ts3.4/validateTokenKey.d.ts +5 -1
- package/dist-types/ts3.4/writeSSOTokenToFile.d.ts +1 -1
- package/dist-types/validateTokenKey.d.ts +1 -1
- package/dist-types/writeSSOTokenToFile.d.ts +2 -2
- package/package.json +6 -6
package/dist-cjs/fromSso.js
CHANGED
|
@@ -37,7 +37,7 @@ const fromSso = (init = {}) => async () => {
|
|
|
37
37
|
ssoToken = await (0, shared_ini_file_loader_1.getSSOTokenFromFile)(ssoSessionName);
|
|
38
38
|
}
|
|
39
39
|
catch (e) {
|
|
40
|
-
throw new property_provider_1.TokenProviderError(`The SSO session associated with
|
|
40
|
+
throw new property_provider_1.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${constants_1.REFRESH_MESSAGE}`, false);
|
|
41
41
|
}
|
|
42
42
|
(0, validateTokenKey_1.validateTokenKey)("accessToken", ssoToken.accessToken);
|
|
43
43
|
(0, validateTokenKey_1.validateTokenKey)("expiresAt", ssoToken.expiresAt);
|
|
@@ -50,9 +50,9 @@ const fromSso = (init = {}) => async () => {
|
|
|
50
50
|
(0, validateTokenExpiry_1.validateTokenExpiry)(existingToken);
|
|
51
51
|
return existingToken;
|
|
52
52
|
}
|
|
53
|
-
(0, validateTokenKey_1.validateTokenKey)("clientId", ssoToken.clientId);
|
|
54
|
-
(0, validateTokenKey_1.validateTokenKey)("clientSecret", ssoToken.clientSecret);
|
|
55
|
-
(0, validateTokenKey_1.validateTokenKey)("refreshToken", ssoToken.refreshToken);
|
|
53
|
+
(0, validateTokenKey_1.validateTokenKey)("clientId", ssoToken.clientId, true);
|
|
54
|
+
(0, validateTokenKey_1.validateTokenKey)("clientSecret", ssoToken.clientSecret, true);
|
|
55
|
+
(0, validateTokenKey_1.validateTokenKey)("refreshToken", ssoToken.refreshToken, true);
|
|
56
56
|
try {
|
|
57
57
|
lastRefreshAttemptTime.setTime(Date.now());
|
|
58
58
|
const newSsoOidcToken = await (0, getNewSsoOidcToken_1.getNewSsoOidcToken)(ssoToken, ssoRegion);
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.validateTokenKey = void 0;
|
|
4
4
|
const property_provider_1 = require("@aws-sdk/property-provider");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
|
-
const validateTokenKey = (key, value) => {
|
|
6
|
+
const validateTokenKey = (key, value, forRefresh = false) => {
|
|
7
7
|
if (typeof value === "undefined") {
|
|
8
|
-
throw new property_provider_1.TokenProviderError(`Value not present for '${key}' in SSO Token
|
|
8
|
+
throw new property_provider_1.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${constants_1.REFRESH_MESSAGE}`, false);
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
11
|
exports.validateTokenKey = validateTokenKey;
|
|
@@ -4,8 +4,8 @@ exports.writeSSOTokenToFile = void 0;
|
|
|
4
4
|
const shared_ini_file_loader_1 = require("@aws-sdk/shared-ini-file-loader");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const { writeFile } = fs_1.promises;
|
|
7
|
-
const writeSSOTokenToFile = (
|
|
8
|
-
const tokenFilepath = (0, shared_ini_file_loader_1.getSSOTokenFilepath)(
|
|
7
|
+
const writeSSOTokenToFile = (id, ssoToken) => {
|
|
8
|
+
const tokenFilepath = (0, shared_ini_file_loader_1.getSSOTokenFilepath)(id);
|
|
9
9
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
10
10
|
return writeFile(tokenFilepath, tokenString);
|
|
11
11
|
};
|
package/dist-es/fromSso.js
CHANGED
|
@@ -34,7 +34,7 @@ export const fromSso = (init = {}) => async () => {
|
|
|
34
34
|
ssoToken = await getSSOTokenFromFile(ssoSessionName);
|
|
35
35
|
}
|
|
36
36
|
catch (e) {
|
|
37
|
-
throw new TokenProviderError(`The SSO session associated with
|
|
37
|
+
throw new TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
|
|
38
38
|
}
|
|
39
39
|
validateTokenKey("accessToken", ssoToken.accessToken);
|
|
40
40
|
validateTokenKey("expiresAt", ssoToken.expiresAt);
|
|
@@ -47,9 +47,9 @@ export const fromSso = (init = {}) => async () => {
|
|
|
47
47
|
validateTokenExpiry(existingToken);
|
|
48
48
|
return existingToken;
|
|
49
49
|
}
|
|
50
|
-
validateTokenKey("clientId", ssoToken.clientId);
|
|
51
|
-
validateTokenKey("clientSecret", ssoToken.clientSecret);
|
|
52
|
-
validateTokenKey("refreshToken", ssoToken.refreshToken);
|
|
50
|
+
validateTokenKey("clientId", ssoToken.clientId, true);
|
|
51
|
+
validateTokenKey("clientSecret", ssoToken.clientSecret, true);
|
|
52
|
+
validateTokenKey("refreshToken", ssoToken.refreshToken, true);
|
|
53
53
|
try {
|
|
54
54
|
lastRefreshAttemptTime.setTime(Date.now());
|
|
55
55
|
const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TokenProviderError } from "@aws-sdk/property-provider";
|
|
2
2
|
import { REFRESH_MESSAGE } from "./constants";
|
|
3
|
-
export const validateTokenKey = (key, value) => {
|
|
3
|
+
export const validateTokenKey = (key, value, forRefresh = false) => {
|
|
4
4
|
if (typeof value === "undefined") {
|
|
5
|
-
throw new TokenProviderError(`Value not present for '${key}' in SSO Token
|
|
5
|
+
throw new TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
6
6
|
}
|
|
7
7
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getSSOTokenFilepath } from "@aws-sdk/shared-ini-file-loader";
|
|
2
2
|
import { promises as fsPromises } from "fs";
|
|
3
3
|
const { writeFile } = fsPromises;
|
|
4
|
-
export const writeSSOTokenToFile = (
|
|
5
|
-
const tokenFilepath = getSSOTokenFilepath(
|
|
4
|
+
export const writeSSOTokenToFile = (id, ssoToken) => {
|
|
5
|
+
const tokenFilepath = getSSOTokenFilepath(id);
|
|
6
6
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
7
7
|
return writeFile(tokenFilepath, tokenString);
|
|
8
8
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SSOToken } from "@aws-sdk/shared-ini-file-loader";
|
|
2
2
|
/**
|
|
3
|
-
* Writes SSO token to file based on filepath computed from ssoStartUrl.
|
|
3
|
+
* Writes SSO token to file based on filepath computed from ssoStartUrl or session name.
|
|
4
4
|
*/
|
|
5
|
-
export declare const writeSSOTokenToFile: (
|
|
5
|
+
export declare const writeSSOTokenToFile: (id: string, ssoToken: SSOToken) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/token-providers",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.209.0",
|
|
4
4
|
"description": "A collection of token providers",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aws-sdk/client-sso-oidc": "3.
|
|
29
|
-
"@aws-sdk/property-provider": "3.
|
|
30
|
-
"@aws-sdk/shared-ini-file-loader": "3.
|
|
31
|
-
"@aws-sdk/types": "3.
|
|
28
|
+
"@aws-sdk/client-sso-oidc": "3.209.0",
|
|
29
|
+
"@aws-sdk/property-provider": "3.208.0",
|
|
30
|
+
"@aws-sdk/shared-ini-file-loader": "3.209.0",
|
|
31
|
+
"@aws-sdk/types": "3.208.0",
|
|
32
32
|
"tslib": "^2.3.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@tsconfig/recommended": "1.0.1",
|
|
36
|
-
"@types/node": "^
|
|
36
|
+
"@types/node": "^14.14.31",
|
|
37
37
|
"concurrently": "7.0.0",
|
|
38
38
|
"downlevel-dts": "0.10.1",
|
|
39
39
|
"rimraf": "3.0.2",
|