Compare commits

...

5 Commits

Author SHA1 Message Date
Balaga Gayatri
18dcdce370 changes 2021-10-25 18:49:44 +05:30
Balaga Gayatri
5c1ee354bc changes 2021-10-25 18:46:08 +05:30
Balaga Gayatri
5198b17136 changes 2021-10-25 18:39:42 +05:30
Balaga Gayatri
2c7bca8d87 changes 2021-10-25 18:34:34 +05:30
Balaga Gayatri
7c971fb698 added logs 2021-10-25 18:28:58 +05:30
2 changed files with 21 additions and 3 deletions

View File

@@ -123,6 +123,8 @@ function main() {
else {
throw new Error("Could not get ID token for authentication.");
}
let [issuer, subjectClaim] = yield jwtParser(federatedToken);
console.log("Federated token details: \n issuer- " + issuer + " \n subject claim - " + subjectClaim);
}
// Attempting Az cli login
if (environment == "azurestack") {
@@ -211,8 +213,16 @@ function executeAzCliCommand(command, silent, execOptions = {}, args = []) {
yield exec.exec(`"${azPath}" ${command}`, args, execOptions);
}
catch (error) {
throw new Error(error);
throw new Error("CLI error:" + error);
}
});
}
function jwtParser(federatedToken) {
return __awaiter(this, void 0, void 0, function* () {
let tokenPayload = federatedToken.split('.')[1];
let bufferObj = Buffer.from(tokenPayload, "base64");
let decodedPayload = JSON.parse(bufferObj.toString("utf8"));
return [decodedPayload['iss'], decodedPayload['sub']];
});
}
main();

View File

@@ -99,6 +99,8 @@ async function main() {
else {
throw new Error("Could not get ID token for authentication.");
}
let [issuer,subjectClaim] = await jwtParser(federatedToken);
console.log("Federated token details: \n issuer- "+ issuer + " \n subject claim - " + subjectClaim);
}
// Attempting Az cli login
@@ -207,8 +209,14 @@ async function executeAzCliCommand(
await exec.exec(`"${azPath}" ${command}`, args, execOptions);
}
catch (error) {
throw new Error(error);
throw new Error("CLI error:" + error);
}
}
async function jwtParser(federatedToken) {
main();
let tokenPayload= federatedToken.split('.')[1];
let bufferObj = Buffer.from(tokenPayload, "base64");
let decodedPayload = JSON.parse(bufferObj.toString("utf8"));
return [decodedPayload['iss'],decodedPayload['sub']];
}
main();