UNPKG

@azure/identity

Version:

Provides credential implementations for Azure SDK libraries that can authenticate with Microsoft Entra ID

68 lines (67 loc) 2.61 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var tenantIdUtils_exports = {}; __export(tenantIdUtils_exports, { checkTenantId: () => checkTenantId, processMultiTenantRequest: () => import_processMultiTenantRequest.processMultiTenantRequest, resolveAdditionallyAllowedTenantIds: () => resolveAdditionallyAllowedTenantIds, resolveTenantId: () => resolveTenantId }); module.exports = __toCommonJS(tenantIdUtils_exports); var import_constants = require("../constants.js"); var import_logging = require("./logging.js"); var import_processMultiTenantRequest = require("./processMultiTenantRequest.js"); function checkTenantId(logger, tenantId) { if (!tenantId.match(/^[0-9a-zA-Z-.]+$/)) { const error = new Error( "Invalid tenant id provided. You can locate your tenant id by following the instructions listed here: https://learn.microsoft.com/partner-center/find-ids-and-domain-names." ); logger.info((0, import_logging.formatError)("", error)); throw error; } } function resolveTenantId(logger, tenantId, clientId) { if (tenantId) { checkTenantId(logger, tenantId); return tenantId; } if (!clientId) { clientId = import_constants.DeveloperSignOnClientId; } if (clientId !== import_constants.DeveloperSignOnClientId) { return "common"; } return "organizations"; } function resolveAdditionallyAllowedTenantIds(additionallyAllowedTenants) { if (!additionallyAllowedTenants || additionallyAllowedTenants.length === 0) { return []; } if (additionallyAllowedTenants.includes("*")) { return import_constants.ALL_TENANTS; } return additionallyAllowedTenants; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { checkTenantId, processMultiTenantRequest, resolveAdditionallyAllowedTenantIds, resolveTenantId }); //# sourceMappingURL=tenantIdUtils.js.map