Skip to content

Commit

Permalink
fix TokenFileWebIdentityCredentials typing (#4388)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenNima committed May 22, 2024
1 parent 9fa11fe commit 3fef5d0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-Typing-102b0d52.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "Typing",
"description": "Align the typing for constructor param of TokenFileWebIdentityCredentials with STS client"
}
4 changes: 2 additions & 2 deletions lib/credentials/token_file_web_identity_credentials.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {Credentials} from '../credentials';
import {AWSError} from '../error';
import {ConfigurationOptions} from '../config-base';
import {ClientConfiguration} from '../../clients/sts';
export class TokenFileWebIdentityCredentials extends Credentials {
/**
* Creates a new credentials object with optional configuraion.
* @param {Object} clientConfig - a map of configuration options to pass to the underlying STS client.
*/
constructor(clientConfig?: ConfigurationOptions);
constructor(clientConfig?: ClientConfiguration);
/**
* Refreshes credentials using AWS.STS.assumeRoleWithWebIdentity().
*/
Expand Down
10 changes: 9 additions & 1 deletion test/credentials.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2121,6 +2121,14 @@ const exp = require('constants');
});
});

it('should forward endpoint param to sts client', function() {
var creds = new AWS.TokenFileWebIdentityCredentials({
endpoint: 'https://testendpoint'
});
creds.createClients();
expect(creds.service.endpoint.hostname).to.equal('testendpoint');
});

return it('fails if params are not available in both environment variables or shared config', function(done) {
delete process.env.AWS_WEB_IDENTITY_TOKEN_FILE;
helpers.spyOn(AWS.util, 'getProfilesFromSharedConfig').andReturn({});
Expand Down Expand Up @@ -2359,7 +2367,7 @@ const exp = require('constants');
});
expect(creds).to.have.property('tokenCodeFn', null);
});
it('should forward enpoint param to sts client', function() {
it('should forward endpoint param to sts client', function() {
var creds = new AWS.ChainableTemporaryCredentials({
stsConfig: { endpoint: 'https://testendpoint' }
});
Expand Down

0 comments on commit 3fef5d0

Please sign in to comment.