mirror of
https://github.com/azure/login.git
synced 2026-06-09 00:17:06 +00:00
added logs
This commit is contained in:
parent
154d5e5db1
commit
7c971fb698
2 changed files with 21 additions and 1 deletions
11
lib/main.js
11
lib/main.js
|
|
@ -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") {
|
||||
|
|
@ -190,6 +192,7 @@ function main() {
|
|||
}
|
||||
catch (error) {
|
||||
if (!isAzCLISuccess) {
|
||||
core.error("CLI error:" + error);
|
||||
core.error("Az CLI Login failed. Please check the credentials. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows");
|
||||
}
|
||||
else {
|
||||
|
|
@ -215,4 +218,12 @@ function executeAzCliCommand(command, silent, execOptions = {}, args = []) {
|
|||
}
|
||||
});
|
||||
}
|
||||
function jwtParser(federatedToken) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let tokenPayload = federatedToken.split('.')[1];
|
||||
let bufferObj = Buffer.from(tokenPayload, "base64");
|
||||
let decodedPayload = bufferObj.toString("utf8");
|
||||
return [decodedPayload["iss"], decodedPayload["sub"]];
|
||||
});
|
||||
}
|
||||
main();
|
||||
|
|
|
|||
11
src/main.ts
11
src/main.ts
|
|
@ -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
|
||||
|
|
@ -183,6 +185,7 @@ async function main() {
|
|||
}
|
||||
catch (error) {
|
||||
if (!isAzCLISuccess) {
|
||||
core.error("CLI error:" + error);
|
||||
core.error("Az CLI Login failed. Please check the credentials. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows");
|
||||
}
|
||||
else {
|
||||
|
|
@ -210,5 +213,11 @@ async function executeAzCliCommand(
|
|||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
async function jwtParser(federatedToken) {
|
||||
|
||||
main();
|
||||
let tokenPayload= federatedToken.split('.')[1];
|
||||
let bufferObj = Buffer.from(tokenPayload, "base64");
|
||||
let decodedPayload = bufferObj.toString("utf8");
|
||||
return [decodedPayload["iss"],decodedPayload["sub"]];
|
||||
}
|
||||
main();
|
||||
Loading…
Add table
Add a link
Reference in a new issue