mirror of
https://github.com/azure/login.git
synced 2026-03-13 18:17:09 -04:00
Compare commits
5 Commits
v1.4.4
...
oidc-suppo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18dcdce370 | ||
|
|
5c1ee354bc | ||
|
|
5198b17136 | ||
|
|
2c7bca8d87 | ||
|
|
7c971fb698 |
12
lib/main.js
12
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") {
|
||||
@@ -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();
|
||||
|
||||
12
src/main.ts
12
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
|
||||
@@ -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();
|
||||
Reference in New Issue
Block a user