Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(credential-provider-node): check sso region in integ test #5791

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ jest.mock("@aws-sdk/client-sso", () => {
return {
...actual,
SSOClient: class {
public constructor(public config: any) {}
async send() {
return {
roleCredentials: {
accessKeyId: "SSO_ACCESS_KEY_ID",
secretAccessKey: "SSO_SECRET_ACCESS_KEY",
sessionToken: "SSO_SESSION_TOKEN",
expiration: new Date("3000-01-01T00:00:00.000Z"),
credentialScope: "us-sso-1",
credentialScope: "us-sso-1-" + this.config.region,
},
};
}
Expand Down Expand Up @@ -285,11 +286,12 @@ describe("credential-provider-node integration test", () => {
describe("fromSSO", () => {
it("should resolve SSO credentials if legacy SSO parameters are supplied directly", async () => {
sts = new STS({
region: "us-sso-1",
// this is lower priority than the ssoRegion.
region: "us-sso-region-2",
credentials: defaultProvider({
ssoStartUrl: "SSO_START_URL",
ssoAccountId: "1234",
ssoRegion: "us-sso-1",
ssoRegion: "us-sso-region-1",
ssoRoleName: "sso-role",
}),
requestHandler: mockRequestHandler,
Expand All @@ -301,7 +303,7 @@ describe("credential-provider-node integration test", () => {
secretAccessKey: "SSO_SECRET_ACCESS_KEY",
sessionToken: "SSO_SESSION_TOKEN",
expiration: new Date("3000-01-01T00:00:00.000Z"),
credentialScope: "us-sso-1",
credentialScope: "us-sso-1-us-sso-region-1",
});
});
});
Expand Down Expand Up @@ -429,12 +431,12 @@ describe("credential-provider-node integration test", () => {

it("should resolve SSO credentials if the profile is an SSO profile", async () => {
iniProfileData["sso-session.ssoNew"] = {
sso_region: "us-sso-1",
sso_region: "us-sso-region-1",
sso_start_url: "SSO_START_URL",
sso_registration_scopes: "sso:account:access",
};
Object.assign(iniProfileData.default, {
sso_region: "us-sso-1",
sso_region: "us-sso-region-1",
sso_session: "ssoNew",
sso_account_id: "1234",
sso_role_name: "integration-test",
Expand All @@ -446,7 +448,7 @@ describe("credential-provider-node integration test", () => {
secretAccessKey: "SSO_SECRET_ACCESS_KEY",
sessionToken: "SSO_SESSION_TOKEN",
expiration: new Date("3000-01-01T00:00:00.000Z"),
credentialScope: "us-sso-1",
credentialScope: "us-sso-1-us-sso-region-1",
});
});
});
Expand Down
Loading