Compare commits

...

15 Commits

Author SHA1 Message Date
Balaga Gayatri
8e1daecdc7 changing node version 2022-06-16 17:58:40 +05:30
Balaga Gayatri
a99f8c8bad Added try catch block to id-token generation 2022-06-16 17:40:05 +05:30
Balaga Gayatri
90b2be557f Update main.js 2022-06-16 17:08:33 +05:30
Balaga Gayatri
3f0aa01c7b Update main.js 2022-06-16 17:04:45 +05:30
Balaga Gayatri
60adb05602 Update main.js 2022-06-16 17:03:43 +05:30
Balaga Gayatri
30cd232abf Update main.js 2022-06-16 16:55:25 +05:30
Balaga Gayatri
0c77b146e2 Update main.js 2022-06-16 16:33:09 +05:30
Balaga Gayatri
7ad701cb24 Update main.js 2022-06-16 16:23:17 +05:30
Balaga Gayatri
34301f7281 Update main.js 2022-06-16 16:21:29 +05:30
Balaga Gayatri
bd142b6a01 Update main.js 2022-06-16 16:15:00 +05:30
Balaga Gayatri
4e74765911 Update main.js 2022-06-15 15:41:53 +05:30
Balaga Gayatri
76d712f450 Update main.js 2022-06-15 15:27:45 +05:30
Balaga Gayatri
6bffdfd9c1 Update main.js 2022-06-15 15:24:20 +05:30
Balaga Gayatri
f0e33b85a1 Update main.js 2022-06-15 15:16:23 +05:30
Balaga Gayatri
05ab5c86c3 Update main.js 2022-06-15 15:11:31 +05:30
3 changed files with 27 additions and 21 deletions

View File

@@ -34,5 +34,5 @@ branding:
icon: 'login.svg'
color: 'blue'
runs:
using: 'node12'
using: 'node16'
main: 'lib/main.js'

View File

@@ -132,17 +132,20 @@ function main() {
// OIDC specific checks
if (enableOIDC) {
console.log('Using OIDC authentication...');
//generating ID-token
let audience = core.getInput('audience', { required: false });
federatedToken = yield core.getIDToken(audience);
if (!!federatedToken) {
if (environment != "azurecloud")
throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`);
let [issuer, subjectClaim] = yield jwtParser(federatedToken);
console.log("Federated token details: \n issuer - " + issuer + " \n subject claim - " + subjectClaim);
try {
//generating ID-token
let audience = core.getInput('audience', { required: false });
federatedToken = yield core.getIDToken(audience);
console.log(`federated token: ${federatedToken}`);
if (!!federatedToken) {
if (environment != "azurecloud")
throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`);
let [issuer, subjectClaim] = yield jwtParser(federatedToken);
console.log("Federated token details: \n issuer - " + issuer + " \n subject claim - " + subjectClaim);
}
}
else {
throw new Error("Could not get ID token for authentication.");
catch (error) {
core.error(`${error.message.split(':')[1]}. Please make sure to give write permissions to id-token in the workflow.`);
}
}
// Attempting Az cli login

View File

@@ -110,17 +110,20 @@ async function main() {
// OIDC specific checks
if (enableOIDC) {
console.log('Using OIDC authentication...')
//generating ID-token
let audience = core.getInput('audience', { required: false });
federatedToken = await core.getIDToken(audience);
if (!!federatedToken) {
if (environment != "azurecloud")
throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`);
let [issuer, subjectClaim] = await jwtParser(federatedToken);
console.log("Federated token details: \n issuer - " + issuer + " \n subject claim - " + subjectClaim);
try {
//generating ID-token
let audience = core.getInput('audience', { required: false });
federatedToken = await core.getIDToken(audience);
console.log(`federated token: ${federatedToken}`);
if (!!federatedToken) {
if (environment != "azurecloud")
throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`);
let [issuer, subjectClaim] = await jwtParser(federatedToken);
console.log("Federated token details: \n issuer - " + issuer + " \n subject claim - " + subjectClaim);
}
}
else {
throw new Error("Could not get ID token for authentication.");
catch (error) {
core.error(`${error.message.split(':')[1]}. Please make sure to give write permissions to id-token in the workflow.`);
}
}