@aws-sdk/credential-provider-login 3.972.38 → 3.972.40
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,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var client = require('@aws-sdk/core/client');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var protocolHttp = require('@smithy/protocol-http');
|
|
4
|
+
var config = require('@smithy/core/config');
|
|
5
|
+
var protocols = require('@smithy/core/protocols');
|
|
7
6
|
var node_crypto = require('node:crypto');
|
|
8
7
|
var node_fs = require('node:fs');
|
|
9
8
|
var node_os = require('node:os');
|
|
@@ -22,7 +21,7 @@ class LoginCredentialsFetcher {
|
|
|
22
21
|
async loadCredentials() {
|
|
23
22
|
const token = await this.loadToken();
|
|
24
23
|
if (!token) {
|
|
25
|
-
throw new
|
|
24
|
+
throw new config.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`, { tryNextLink: false, logger: this.logger });
|
|
26
25
|
}
|
|
27
26
|
const accessToken = token.accessToken;
|
|
28
27
|
const now = Date.now();
|
|
@@ -79,7 +78,7 @@ class LoginCredentialsFetcher {
|
|
|
79
78
|
const { accessKeyId, secretAccessKey, sessionToken } = response.tokenOutput?.accessToken ?? {};
|
|
80
79
|
const { refreshToken, expiresIn } = response.tokenOutput ?? {};
|
|
81
80
|
if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {
|
|
82
|
-
throw new
|
|
81
|
+
throw new config.CredentialsProviderError("Token refresh response missing required fields", {
|
|
83
82
|
logger: this.logger,
|
|
84
83
|
tryNextLink: false,
|
|
85
84
|
});
|
|
@@ -126,9 +125,9 @@ class LoginCredentialsFetcher {
|
|
|
126
125
|
default:
|
|
127
126
|
message = `Failed to refresh token: ${String(error)}. Please re-authenticate using \`aws login\``;
|
|
128
127
|
}
|
|
129
|
-
throw new
|
|
128
|
+
throw new config.CredentialsProviderError(message, { logger: this.logger, tryNextLink: false });
|
|
130
129
|
}
|
|
131
|
-
throw new
|
|
130
|
+
throw new config.CredentialsProviderError(`Failed to refresh token: ${String(error)}. Please re-authenticate using aws login`, { logger: this.logger });
|
|
132
131
|
}
|
|
133
132
|
}
|
|
134
133
|
async loadToken() {
|
|
@@ -136,7 +135,7 @@ class LoginCredentialsFetcher {
|
|
|
136
135
|
try {
|
|
137
136
|
let tokenData;
|
|
138
137
|
try {
|
|
139
|
-
tokenData = await
|
|
138
|
+
tokenData = await config.readFile(tokenFilePath, { ignoreCache: this.init?.ignoreCache });
|
|
140
139
|
}
|
|
141
140
|
catch {
|
|
142
141
|
tokenData = await node_fs.promises.readFile(tokenFilePath, "utf8");
|
|
@@ -147,7 +146,7 @@ class LoginCredentialsFetcher {
|
|
|
147
146
|
missingFields.push("accountId");
|
|
148
147
|
}
|
|
149
148
|
if (missingFields.length > 0) {
|
|
150
|
-
throw new
|
|
149
|
+
throw new config.CredentialsProviderError(`Token validation failed, missing fields: ${missingFields.join(", ")}`, {
|
|
151
150
|
logger: this.logger,
|
|
152
151
|
tryNextLink: false,
|
|
153
152
|
});
|
|
@@ -155,7 +154,7 @@ class LoginCredentialsFetcher {
|
|
|
155
154
|
return token;
|
|
156
155
|
}
|
|
157
156
|
catch (error) {
|
|
158
|
-
throw new
|
|
157
|
+
throw new config.CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(error)}`, {
|
|
159
158
|
logger: this.logger,
|
|
160
159
|
tryNextLink: false,
|
|
161
160
|
});
|
|
@@ -200,7 +199,7 @@ class LoginCredentialsFetcher {
|
|
|
200
199
|
}
|
|
201
200
|
createDPoPInterceptor(middlewareStack) {
|
|
202
201
|
middlewareStack.add((next) => async (args) => {
|
|
203
|
-
if (
|
|
202
|
+
if (protocols.HttpRequest.isInstance(args.request)) {
|
|
204
203
|
const request = args.request;
|
|
205
204
|
const actualEndpoint = `${request.protocol}//${request.hostname}${request.port ? `:${request.port}` : ""}${request.path}`;
|
|
206
205
|
const dpop = await this.generateDpop(request.method, actualEndpoint);
|
|
@@ -260,20 +259,20 @@ class LoginCredentialsFetcher {
|
|
|
260
259
|
return `${message}.${signatureB64}`;
|
|
261
260
|
}
|
|
262
261
|
catch (error) {
|
|
263
|
-
throw new
|
|
262
|
+
throw new config.CredentialsProviderError(`Failed to generate Dpop proof: ${error instanceof Error ? error.message : String(error)}`, { logger: this.logger, tryNextLink: false });
|
|
264
263
|
}
|
|
265
264
|
}
|
|
266
265
|
}
|
|
267
266
|
|
|
268
267
|
const fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {
|
|
269
268
|
init?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");
|
|
270
|
-
const profiles = await
|
|
271
|
-
const profileName =
|
|
269
|
+
const profiles = await config.parseKnownFiles(init || {});
|
|
270
|
+
const profileName = config.getProfileName({
|
|
272
271
|
profile: init?.profile ?? callerClientConfig?.profile,
|
|
273
272
|
});
|
|
274
273
|
const profile = profiles[profileName];
|
|
275
274
|
if (!profile?.login_session) {
|
|
276
|
-
throw new
|
|
275
|
+
throw new config.CredentialsProviderError(`Profile ${profileName} does not contain login_session.`, {
|
|
277
276
|
tryNextLink: true,
|
|
278
277
|
logger: init?.logger,
|
|
279
278
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { CredentialsProviderError } from "@smithy/
|
|
2
|
-
import { HttpRequest } from "@smithy/
|
|
3
|
-
import { readFile } from "@smithy/shared-ini-file-loader";
|
|
1
|
+
import { CredentialsProviderError, readFile } from "@smithy/core/config";
|
|
2
|
+
import { HttpRequest } from "@smithy/core/protocols";
|
|
4
3
|
import { createHash, createPrivateKey, createPublicKey, sign } from "node:crypto";
|
|
5
4
|
import { promises as fs } from "node:fs";
|
|
6
5
|
import { homedir } from "node:os";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { setCredentialFeature } from "@aws-sdk/core/client";
|
|
2
|
-
import { CredentialsProviderError } from "@smithy/
|
|
3
|
-
import { getProfileName, parseKnownFiles } from "@smithy/shared-ini-file-loader";
|
|
2
|
+
import { CredentialsProviderError, getProfileName, parseKnownFiles } from "@smithy/core/config";
|
|
4
3
|
import { LoginCredentialsFetcher } from "./LoginCredentialsFetcher";
|
|
5
4
|
export const fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {
|
|
6
5
|
init?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SigninClientConfig } from "@aws-sdk/nested-clients/signin";
|
|
2
2
|
import { CredentialProviderOptions } from "@aws-sdk/types";
|
|
3
|
-
import { SharedConfigInit } from "@smithy/
|
|
3
|
+
import { SharedConfigInit } from "@smithy/core/config";
|
|
4
4
|
export interface FromLoginCredentialsInit
|
|
5
5
|
extends CredentialProviderOptions,
|
|
6
6
|
SharedConfigInit {
|
package/dist-types/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SigninClientConfig } from "@aws-sdk/nested-clients/signin";
|
|
2
2
|
import type { CredentialProviderOptions } from "@aws-sdk/types";
|
|
3
|
-
import type { SharedConfigInit } from "@smithy/
|
|
3
|
+
import type { SharedConfigInit } from "@smithy/core/config";
|
|
4
4
|
/**
|
|
5
5
|
* Configuration options for the Login credential provider
|
|
6
6
|
* @public
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-login",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.40",
|
|
4
4
|
"description": "AWS credential provider that sources credentials from aws login cached tokens",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -28,12 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aws-sdk/core": "^3.974.
|
|
32
|
-
"@aws-sdk/nested-clients": "^3.997.
|
|
31
|
+
"@aws-sdk/core": "^3.974.10",
|
|
32
|
+
"@aws-sdk/nested-clients": "^3.997.8",
|
|
33
33
|
"@aws-sdk/types": "^3.973.8",
|
|
34
|
-
"@smithy/
|
|
35
|
-
"@smithy/protocol-http": "^5.3.14",
|
|
36
|
-
"@smithy/shared-ini-file-loader": "^4.4.9",
|
|
34
|
+
"@smithy/core": "^3.24.1",
|
|
37
35
|
"@smithy/types": "^4.14.1",
|
|
38
36
|
"tslib": "^2.6.2"
|
|
39
37
|
},
|