Skip to content

Commit 3fef5d0

Browse files
authored
fix TokenFileWebIdentityCredentials typing (#4388)
1 parent 9fa11fe commit 3fef5d0

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "bugfix",
3+
"category": "Typing",
4+
"description": "Align the typing for constructor param of TokenFileWebIdentityCredentials with STS client"
5+
}

lib/credentials/token_file_web_identity_credentials.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {Credentials} from '../credentials';
22
import {AWSError} from '../error';
3-
import {ConfigurationOptions} from '../config-base';
3+
import {ClientConfiguration} from '../../clients/sts';
44
export class TokenFileWebIdentityCredentials extends Credentials {
55
/**
66
* Creates a new credentials object with optional configuraion.
77
* @param {Object} clientConfig - a map of configuration options to pass to the underlying STS client.
88
*/
9-
constructor(clientConfig?: ConfigurationOptions);
9+
constructor(clientConfig?: ClientConfiguration);
1010
/**
1111
* Refreshes credentials using AWS.STS.assumeRoleWithWebIdentity().
1212
*/

test/credentials.spec.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,14 @@ const exp = require('constants');
21212121
});
21222122
});
21232123

2124+
it('should forward endpoint param to sts client', function() {
2125+
var creds = new AWS.TokenFileWebIdentityCredentials({
2126+
endpoint: 'https://testendpoint'
2127+
});
2128+
creds.createClients();
2129+
expect(creds.service.endpoint.hostname).to.equal('testendpoint');
2130+
});
2131+
21242132
return it('fails if params are not available in both environment variables or shared config', function(done) {
21252133
delete process.env.AWS_WEB_IDENTITY_TOKEN_FILE;
21262134
helpers.spyOn(AWS.util, 'getProfilesFromSharedConfig').andReturn({});
@@ -2359,7 +2367,7 @@ const exp = require('constants');
23592367
});
23602368
expect(creds).to.have.property('tokenCodeFn', null);
23612369
});
2362-
it('should forward enpoint param to sts client', function() {
2370+
it('should forward endpoint param to sts client', function() {
23632371
var creds = new AWS.ChainableTemporaryCredentials({
23642372
stsConfig: { endpoint: 'https://testendpoint' }
23652373
});

0 commit comments

Comments
 (0)