mirror of
https://github.com/azure/login.git
synced 2026-03-15 09:20:56 -04:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92a5484dfa | ||
|
|
24848bc889 |
@@ -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'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class Constants {
|
|||||||
exports.default = Constants;
|
exports.default = Constants;
|
||||||
Constants.prefix = "az_";
|
Constants.prefix = "az_";
|
||||||
Constants.moduleName = "Az.Accounts";
|
Constants.moduleName = "Az.Accounts";
|
||||||
Constants.versionPattern = /[0-9]\.[0-9]\.[0-9]/;
|
Constants.versionPattern = /[0-9]+\.[0-9]+\.[0-9]+/;
|
||||||
Constants.AzureCloud = "AzureCloud";
|
Constants.AzureCloud = "AzureCloud";
|
||||||
Constants.Subscription = "Subscription";
|
Constants.Subscription = "Subscription";
|
||||||
Constants.ServicePrincipal = "ServicePrincipal";
|
Constants.ServicePrincipal = "ServicePrincipal";
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ function main() {
|
|||||||
// OIDC specific checks
|
// OIDC specific checks
|
||||||
if (enableOIDC) {
|
if (enableOIDC) {
|
||||||
console.log('Using OIDC authentication...');
|
console.log('Using OIDC authentication...');
|
||||||
|
try {
|
||||||
//generating ID-token
|
//generating ID-token
|
||||||
let audience = core.getInput('audience', { required: false });
|
let audience = core.getInput('audience', { required: false });
|
||||||
federatedToken = yield core.getIDToken(audience);
|
federatedToken = yield core.getIDToken(audience);
|
||||||
@@ -141,8 +142,9 @@ function main() {
|
|||||||
let [issuer, subjectClaim] = yield jwtParser(federatedToken);
|
let [issuer, subjectClaim] = yield jwtParser(federatedToken);
|
||||||
console.log("Federated token details: \n issuer - " + issuer + " \n subject claim - " + subjectClaim);
|
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
|
// Attempting Az cli login
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export default class Constants {
|
export default class Constants {
|
||||||
static readonly prefix: string = "az_";
|
static readonly prefix: string = "az_";
|
||||||
static readonly moduleName: string = "Az.Accounts";
|
static readonly moduleName: string = "Az.Accounts";
|
||||||
static readonly versionPattern = /[0-9]\.[0-9]\.[0-9]/;
|
static readonly versionPattern = /[0-9]+\.[0-9]+\.[0-9]+/;
|
||||||
|
|
||||||
static readonly AzureCloud: string = "AzureCloud";
|
static readonly AzureCloud: string = "AzureCloud";
|
||||||
static readonly Subscription: string = "Subscription";
|
static readonly Subscription: string = "Subscription";
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ async function main() {
|
|||||||
// OIDC specific checks
|
// OIDC specific checks
|
||||||
if (enableOIDC) {
|
if (enableOIDC) {
|
||||||
console.log('Using OIDC authentication...')
|
console.log('Using OIDC authentication...')
|
||||||
|
try {
|
||||||
//generating ID-token
|
//generating ID-token
|
||||||
let audience = core.getInput('audience', { required: false });
|
let audience = core.getInput('audience', { required: false });
|
||||||
federatedToken = await core.getIDToken(audience);
|
federatedToken = await core.getIDToken(audience);
|
||||||
@@ -119,8 +120,9 @@ async function main() {
|
|||||||
let [issuer, subjectClaim] = await jwtParser(federatedToken);
|
let [issuer, subjectClaim] = await jwtParser(federatedToken);
|
||||||
console.log("Federated token details: \n issuer - " + issuer + " \n subject claim - " + subjectClaim);
|
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.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user