mirror of
https://github.com/azure/login.git
synced 2026-06-08 15:17:04 +00:00
Compare commits
2 commits
master
...
id-token-e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63108bf3cf | ||
|
|
6143ae0900 |
3 changed files with 26 additions and 22 deletions
|
|
@ -34,5 +34,5 @@ branding:
|
||||||
icon: 'login.svg'
|
icon: 'login.svg'
|
||||||
color: 'blue'
|
color: 'blue'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node16'
|
||||||
main: 'lib/main.js'
|
main: 'lib/main.js'
|
||||||
22
lib/main.js
22
lib/main.js
|
|
@ -132,17 +132,19 @@ function main() {
|
||||||
// OIDC specific checks
|
// OIDC specific checks
|
||||||
if (enableOIDC) {
|
if (enableOIDC) {
|
||||||
console.log('Using OIDC authentication...');
|
console.log('Using OIDC authentication...');
|
||||||
//generating ID-token
|
try {
|
||||||
let audience = core.getInput('audience', { required: false });
|
//generating ID-token
|
||||||
federatedToken = yield core.getIDToken(audience);
|
let audience = core.getInput('audience', { required: false });
|
||||||
if (!!federatedToken) {
|
federatedToken = yield core.getIDToken(audience);
|
||||||
if (environment != "azurecloud")
|
if (!!federatedToken) {
|
||||||
throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`);
|
if (environment != "azurecloud")
|
||||||
let [issuer, subjectClaim] = yield jwtParser(federatedToken);
|
throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`);
|
||||||
console.log("Federated token details: \n issuer - " + issuer + " \n subject claim - " + subjectClaim);
|
let [issuer, subjectClaim] = yield jwtParser(federatedToken);
|
||||||
|
console.log("Federated token details: \n issuer - " + issuer + " \n subject claim - " + subjectClaim);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
catch (error) {
|
||||||
throw new Error("Could not get ID token for authentication.");
|
core.error(`${error.message.split(':')[1]}. Please make sure to give write permissions to id-token in the workflow.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Attempting Az cli login
|
// Attempting Az cli login
|
||||||
|
|
|
||||||
22
src/main.ts
22
src/main.ts
|
|
@ -110,17 +110,19 @@ async function main() {
|
||||||
// OIDC specific checks
|
// OIDC specific checks
|
||||||
if (enableOIDC) {
|
if (enableOIDC) {
|
||||||
console.log('Using OIDC authentication...')
|
console.log('Using OIDC authentication...')
|
||||||
//generating ID-token
|
try {
|
||||||
let audience = core.getInput('audience', { required: false });
|
//generating ID-token
|
||||||
federatedToken = await core.getIDToken(audience);
|
let audience = core.getInput('audience', { required: false });
|
||||||
if (!!federatedToken) {
|
federatedToken = await core.getIDToken(audience);
|
||||||
if (environment != "azurecloud")
|
if (!!federatedToken) {
|
||||||
throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`);
|
if (environment != "azurecloud")
|
||||||
let [issuer, subjectClaim] = await jwtParser(federatedToken);
|
throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`);
|
||||||
console.log("Federated token details: \n issuer - " + issuer + " \n subject claim - " + subjectClaim);
|
let [issuer, subjectClaim] = await jwtParser(federatedToken);
|
||||||
|
console.log("Federated token details: \n issuer - " + issuer + " \n subject claim - " + subjectClaim);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
catch (error) {
|
||||||
throw new Error("Could not get ID token for authentication.");
|
core.error(`${error.message.split(':')[1]}. Please make sure to give write permissions to id-token in the workflow.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue