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

chore(client-cognito-identity): add default credentialDefaultProvider #1702

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented Nov 19, 2020

Issue #, if available:
Noticed while debugging STS.assumeRoleWithWebIdentity issue in #1602

Description of changes:
add default credentialDefaultProvider in client-cognito-identity as customization for specific commands is done in

if (testServiceId(service, "Cognito Identity")) {
Boolean isUnsignedCommand = SetUtils
.of("GetId", "GetOpenIdToken", "GetCredentialsForIdentity", "UnlinkIdentity")
.contains(operation.getId().getName());
return !isUnsignedCommand;
}

Tested with the following:

Code
const {
  CognitoIdentity,
} = require("/home/trivikr/workspace/aws-sdk-js-v3/clients/client-cognito-identity");

(async () => {
  const region = "us-west-2";

  const client = new CognitoIdentity({ region });
  console.log(await client.getId({ IdentityPoolId: "<REDACTED>" }));
})();
Output
{
  '$metadata': {
    httpStatusCode: 200,
    httpHeaders: {
      date: 'Thu, 19 Nov 2020 22:55:03 GMT',
      'content-type': 'application/x-amz-json-1.1',
      'content-length': '63',
      connection: 'keep-alive',
      'x-amzn-requestid': 'bfa5ab15-17de-4b25-a67a-b5af882dcb1e'
    },
    requestId: 'bfa5ab15-17de-4b25-a67a-b5af882dcb1e',
    attempts: 1,
    totalRetryDelay: 0
  },
  IdentityId: '<REDACTED>'
}

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-io
Copy link

Codecov Report

Merging #1702 (357167e) into master (de75f7e) will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1702      +/-   ##
==========================================
- Coverage   79.77%   79.76%   -0.02%     
==========================================
  Files         325      329       +4     
  Lines       12087    12575     +488     
  Branches     2553     2672     +119     
==========================================
+ Hits         9643    10030     +387     
- Misses       2444     2545     +101     
Impacted Files Coverage Δ
...tocol_tests/aws-restxml/commands/XmlMapsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ocol_tests/aws-restxml/commands/XmlBlobsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ocol_tests/aws-restxml/commands/XmlEnumsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ocol_tests/aws-restxml/commands/XmlListsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...col_tests/aws-restjson/commands/JsonMapsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ol_tests/aws-restjson/commands/JsonBlobsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ol_tests/aws-restjson/commands/JsonEnumsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ol_tests/aws-restjson/commands/JsonListsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...tests/aws-restxml/commands/XmlAttributesCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...tests/aws-restxml/commands/XmlNamespacesCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
... and 110 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 778b305...357167e. Read the comment docs.

@trivikr
Copy link
Member Author

trivikr commented Nov 20, 2020

The disabling of credentialDefaultProvider is not required as we await for credentialProvider only in signer

const credentials = await this.credentialProvider();

The signer is not called for the commands where AwsAuthPlugin is not added.

@trivikr trivikr requested a review from AllanZhengYP November 20, 2020 01:45
@trivikr trivikr force-pushed the remove-customization-credentialProvider-cognito-identity branch from 357167e to e4635bf Compare November 25, 2020 16:18
@trivikr
Copy link
Member Author

trivikr commented Nov 25, 2020

Superceded by #1719

@trivikr trivikr closed this Nov 30, 2020
@github-actions
Copy link

github-actions bot commented Jan 9, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 9, 2021
@trivikr trivikr deleted the remove-customization-credentialProvider-cognito-identity branch March 16, 2021 02:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants