Skip to content

Commit 08b3253

Browse files
committed
fix: fix app server auth
1 parent 0a72e3f commit 08b3253

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed

action/dist/main/index.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66263,20 +66263,22 @@ async function getAccessToken(tokenRequest) {
6626366263
throw error;
6626466264
});
6626566265
let requestSigner;
66266-
if (config.appServer.auth?.type === 'aws') {
66267-
requestSigner = new dist_cjs.SignatureV4({
66268-
sha256: main.Sha256,
66269-
service: config.appServer.auth.service,
66270-
region: config.appServer.auth.region,
66271-
credentials: (0,credential_providers_dist_cjs.fromWebToken)({
66272-
webIdentityToken: await core.getIDToken('sts.amazonaws.com'),
66273-
roleArn: config.appServer.auth.roleArn,
66274-
durationSeconds: 900, // 15 minutes are the minimum allowed by AWS
66275-
}),
66276-
});
66277-
}
66278-
else {
66279-
throw new Error(`Unsupported app server auth type: ${config.appServer.auth?.type}`);
66266+
if (config.appServer.auth) {
66267+
if (config.appServer.auth.type === 'aws') {
66268+
requestSigner = new dist_cjs.SignatureV4({
66269+
sha256: main.Sha256,
66270+
service: config.appServer.auth.service,
66271+
region: config.appServer.auth.region,
66272+
credentials: (0,credential_providers_dist_cjs.fromWebToken)({
66273+
webIdentityToken: await core.getIDToken('sts.amazonaws.com'),
66274+
roleArn: config.appServer.auth.roleArn,
66275+
durationSeconds: 900, // 15 minutes are the minimum allowed by AWS
66276+
}),
66277+
});
66278+
}
66279+
else {
66280+
throw new Error(`Unsupported app server auth type: ${config.appServer.auth?.type}`);
66281+
}
6628066282
}
6628166283
return await httpRequest({
6628266284
method: 'POST', requestUrl: new URL('/access_tokens', config.appServer.url).href,

action/src/action-main.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,21 @@ async function getAccessToken(tokenRequest: {
7373
});
7474

7575
let requestSigner;
76-
if (config.appServer.auth?.type === 'aws') {
77-
requestSigner = new SignatureV4({
78-
sha256: Sha256,
79-
service: config.appServer.auth.service,
80-
region: config.appServer.auth.region,
81-
credentials: fromWebToken({
82-
webIdentityToken: await core.getIDToken('sts.amazonaws.com'),
83-
roleArn: config.appServer.auth.roleArn,
84-
durationSeconds: 900, // 15 minutes are the minimum allowed by AWS
85-
}),
86-
});
87-
} else {
88-
throw new Error(`Unsupported app server auth type: ${config.appServer.auth?.type}`);
76+
if (config.appServer.auth) {
77+
if (config.appServer.auth.type === 'aws') {
78+
requestSigner = new SignatureV4({
79+
sha256: Sha256,
80+
service: config.appServer.auth.service,
81+
region: config.appServer.auth.region,
82+
credentials: fromWebToken({
83+
webIdentityToken: await core.getIDToken('sts.amazonaws.com'),
84+
roleArn: config.appServer.auth.roleArn,
85+
durationSeconds: 900, // 15 minutes are the minimum allowed by AWS
86+
}),
87+
});
88+
} else {
89+
throw new Error(`Unsupported app server auth type: ${config.appServer.auth?.type}`);
90+
}
8991
}
9092

9193
return await httpRequest({

0 commit comments

Comments
 (0)