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

fix TokenFileWebIdentityCredentials typing #4388

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -2106,6 +2106,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 @@ -2344,7 +2352,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