Skip to content

Commit b0101e5

Browse files
committed
chore(middleware-signing): pass fips/dualstack config to regionInfoProvider
1 parent df0503a commit b0101e5

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

packages/middleware-signing/src/configuration.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { HttpRequest } from "@aws-sdk/protocol-http";
33
import { resolveAwsAuthConfig, resolveSigV4AuthConfig } from "./configurations";
44

55
describe("AuthConfig", () => {
6-
76
describe("resolveAwsAuthConfig", () => {
87
const inputParams = {
98
credentialDefaultProvider: () => () => Promise.resolve({ accessKeyId: "key", secretAccessKey: "secret" }),
@@ -15,6 +14,8 @@ describe("AuthConfig", () => {
1514
digest: jest.fn().mockReturnValue("SHA256 hash"),
1615
}),
1716
credentials: jest.fn().mockResolvedValue({ accessKeyId: "key", secretAccessKey: "secret" }),
17+
useFipsEndpoint: () => Promise.resolve(false),
18+
useDualstackEndpoint: () => Promise.resolve(false),
1819
};
1920

2021
beforeEach(() => {

packages/middleware-signing/src/configurations.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { memoize } from "@aws-sdk/property-provider";
22
import { SignatureV4, SignatureV4CryptoInit, SignatureV4Init } from "@aws-sdk/signature-v4";
33
import { Credentials, HashConstructor, Provider, RegionInfo, RegionInfoProvider, RequestSigner } from "@aws-sdk/types";
4+
import { options } from "yargs";
45

56
// 5 minutes buffer time the refresh the credential before it really expires
67
const CREDENTIAL_EXPIRE_WINDOW = 300000;
@@ -73,6 +74,8 @@ interface PreviouslyResolved {
7374
signingName?: string;
7475
serviceId: string;
7576
sha256: HashConstructor;
77+
useFipsEndpoint: Provider<boolean>;
78+
useDualstackEndpoint: Provider<boolean>;
7679
}
7780

7881
interface SigV4PreviouslyResolved {
@@ -118,7 +121,16 @@ export const resolveAwsAuthConfig = <T>(
118121
//construct a provider inferring signing from region.
119122
signer = () =>
120123
normalizeProvider(input.region)()
121-
.then(async (region) => [(await input.regionInfoProvider(region)) || {}, region] as [RegionInfo, string])
124+
.then(
125+
async (region) =>
126+
[
127+
(await input.regionInfoProvider(region, {
128+
useFipsEndpoint: await input.useFipsEndpoint(),
129+
useDualstackEndpoint: await input.useDualstackEndpoint(),
130+
})) || {},
131+
region,
132+
] as [RegionInfo, string]
133+
)
122134
.then(([regionInfo, region]) => {
123135
const { signingRegion, signingService } = regionInfo;
124136
//update client's singing region and signing service config if they are resolved.

0 commit comments

Comments
 (0)