UNPKG

msal

Version:
54 lines 2.33 kB
"use strict"; // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var AadAuthority_1 = require("./AadAuthority"); var Authority_1 = require("./Authority"); var ClientConfigurationError_1 = require("./error/ClientConfigurationError"); var UrlUtils_1 = require("./utils/UrlUtils"); /** * @hidden */ var B2cAuthority = /** @class */ (function (_super) { tslib_1.__extends(B2cAuthority, _super); function B2cAuthority(authority, validateAuthority) { var _this = _super.call(this, authority, validateAuthority) || this; var urlComponents = UrlUtils_1.UrlUtils.GetUrlComponents(authority); var pathSegments = urlComponents.PathSegments; if (pathSegments.length < 3) { throw ClientConfigurationError_1.ClientConfigurationErrorMessage.b2cAuthorityUriInvalidPath; } _this.CanonicalAuthority = "https://" + urlComponents.HostNameAndPort + "/" + pathSegments[0] + "/" + pathSegments[1] + "/" + pathSegments[2] + "/"; return _this; } Object.defineProperty(B2cAuthority.prototype, "AuthorityType", { get: function () { return Authority_1.AuthorityType.B2C; }, enumerable: true, configurable: true }); /** * Returns a promise with the TenantDiscoveryEndpoint */ B2cAuthority.prototype.GetOpenIdConfigurationEndpointAsync = function () { var _this = this; var resultPromise = new Promise(function (resolve, reject) { return resolve(_this.DefaultOpenIdConfigurationEndpoint); }); if (!this.IsValidationEnabled) { return resultPromise; } if (this.IsInTrustedHostList(this.CanonicalAuthorityUrlComponents.HostNameAndPort)) { return resultPromise; } return new Promise(function (resolve, reject) { return reject(ClientConfigurationError_1.ClientConfigurationErrorMessage.unsupportedAuthorityValidation); }); }; B2cAuthority.B2C_PREFIX = "tfp"; return B2cAuthority; }(AadAuthority_1.AadAuthority)); exports.B2cAuthority = B2cAuthority; //# sourceMappingURL=B2cAuthority.js.map