Skip to content

Commit a5834c4

Browse files
committed
ARSN-531: add AccessKey to AuthInfo
1 parent 5a79211 commit a5834c4

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

lib/auth/AuthInfo.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,14 @@ export default class AuthInfo {
5959
IAMdisplayName: string;
6060
authVersion?: string;
6161
authType?: string;
62+
accessKey?: string;
6263

63-
constructor(objectFromVault: any, authVersion?: string, authType?: string) {
64+
constructor(
65+
objectFromVault: any,
66+
authVersion?: string,
67+
authType?: string,
68+
accessKey?: string,
69+
) {
6470
// amazon resource name for IAM user (if applicable)
6571
this.arn = objectFromVault.arn;
6672
// account canonicalID
@@ -93,6 +99,7 @@ export default class AuthInfo {
9399
this.authType = authType;
94100
break;
95101
}
102+
this.accessKey = accessKey;
96103
}
97104
getArn() {
98105
return this.arn;
@@ -118,6 +125,9 @@ export default class AuthInfo {
118125
getAuthType() {
119126
return this.authType;
120127
}
128+
getAccessKey() {
129+
return this.accessKey;
130+
}
121131
// Check whether requester is an IAM user versus an account
122132
isRequesterAnIAMUser() {
123133
return !!this.IAMdisplayName;

lib/auth/Vault.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export function vaultSignatureCb(
3131
) => void,
3232
streamingV4Params?: any,
3333
authType?: string,
34+
accessKey?: string,
3435
) {
3536
// vaultclient API guarantees that it returns:
3637
// - either `err`, an Error object with `code` and `message` properties set
@@ -53,7 +54,7 @@ export function vaultSignatureCb(
5354

5455
const info = authInfo.message.body as AuthV4Results;
5556
const userInfo = new AuthInfo(info.userInfo,
56-
streamingV4Params ? 'SigV4' : 'SigV2', authType);
57+
streamingV4Params ? 'SigV4' : 'SigV2', authType, accessKey);
5758
const authorizationResults = info.authorizationResults;
5859
const auditLog: { accountDisplayName: string, IAMdisplayName?: string } =
5960
{ accountDisplayName: userInfo.getAccountDisplayName() };
@@ -176,7 +177,7 @@ export default class Vault {
176177
},
177178
(err: Error | null, userInfo?: any) => vaultSignatureCb(err,
178179
userInfo, params.log, callback, undefined,
179-
params.data.authType),
180+
params.data.authType, params.data.accessKey),
180181
);
181182
}
182183

@@ -239,7 +240,8 @@ export default class Vault {
239240
},
240241
(err: Error | null, userInfo?: any) => vaultSignatureCb(err,
241242
userInfo, params.log, callback,
242-
streamingV4Params, params.data.authType),
243+
streamingV4Params,
244+
params.data.authType, params.data.accessKey),
243245
);
244246
}
245247

0 commit comments

Comments
 (0)