@azure/msal-common 4.2.1 → 4.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +212 -1
- package/LICENSE +21 -21
- package/README.md +61 -58
- package/changelog.md +402 -344
- package/dist/_virtual/_tslib.js +90 -0
- package/dist/_virtual/_tslib.js.map +1 -0
- package/dist/account/AuthToken.js +43 -0
- package/dist/account/AuthToken.js.map +1 -0
- package/dist/account/CcsCredential.d.ts +9 -0
- package/dist/account/CcsCredential.d.ts.map +1 -0
- package/dist/account/CcsCredential.js +14 -0
- package/dist/account/CcsCredential.js.map +1 -0
- package/dist/account/ClientInfo.d.ts +6 -1
- package/dist/account/ClientInfo.d.ts.map +1 -1
- package/dist/account/ClientInfo.js +44 -0
- package/dist/account/ClientInfo.js.map +1 -0
- package/dist/account/TokenClaims.d.ts +1 -0
- package/dist/account/TokenClaims.d.ts.map +1 -1
- package/dist/authority/Authority.d.ts +25 -0
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.js +574 -0
- package/dist/authority/Authority.js.map +1 -0
- package/dist/authority/AuthorityFactory.js +69 -0
- package/dist/authority/AuthorityFactory.js.map +1 -0
- package/dist/authority/AuthorityOptions.d.ts +2 -0
- package/dist/authority/AuthorityOptions.d.ts.map +1 -1
- package/dist/authority/AuthorityType.js +17 -0
- package/dist/authority/AuthorityType.js.map +1 -0
- package/dist/authority/AzureRegion.d.ts +2 -0
- package/dist/authority/AzureRegion.d.ts.map +1 -0
- package/dist/authority/AzureRegionConfiguration.d.ts +6 -0
- package/dist/authority/AzureRegionConfiguration.d.ts.map +1 -0
- package/dist/authority/CloudInstanceDiscoveryResponse.js +13 -0
- package/dist/authority/CloudInstanceDiscoveryResponse.js.map +1 -0
- package/dist/authority/OpenIdConfigResponse.js +15 -0
- package/dist/authority/OpenIdConfigResponse.js.map +1 -0
- package/dist/authority/ProtocolMode.js +17 -0
- package/dist/authority/ProtocolMode.js.map +1 -0
- package/dist/authority/RegionDiscovery.d.ts +31 -0
- package/dist/authority/RegionDiscovery.d.ts.map +1 -0
- package/dist/authority/RegionDiscovery.js +119 -0
- package/dist/authority/RegionDiscovery.js.map +1 -0
- package/dist/authority/RegionDiscoveryMetadata.d.ts +7 -0
- package/dist/authority/RegionDiscoveryMetadata.d.ts.map +1 -0
- package/dist/cache/CacheManager.js +713 -0
- package/dist/cache/CacheManager.js.map +1 -0
- package/dist/cache/entities/AccessTokenEntity.js +111 -0
- package/dist/cache/entities/AccessTokenEntity.js.map +1 -0
- package/dist/cache/entities/AccountEntity.d.ts +5 -5
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.js +242 -0
- package/dist/cache/entities/AccountEntity.js.map +1 -0
- package/dist/cache/entities/AppMetadataEntity.js +74 -0
- package/dist/cache/entities/AppMetadataEntity.js.map +1 -0
- package/dist/cache/entities/AuthorityMetadataEntity.js +81 -0
- package/dist/cache/entities/AuthorityMetadataEntity.js.map +1 -0
- package/dist/cache/entities/CacheRecord.js +19 -0
- package/dist/cache/entities/CacheRecord.js.map +1 -0
- package/dist/cache/entities/CredentialEntity.js +142 -0
- package/dist/cache/entities/CredentialEntity.js.map +1 -0
- package/dist/cache/entities/IdTokenEntity.js +71 -0
- package/dist/cache/entities/IdTokenEntity.js.map +1 -0
- package/dist/cache/entities/RefreshTokenEntity.js +73 -0
- package/dist/cache/entities/RefreshTokenEntity.js.map +1 -0
- package/dist/cache/entities/ServerTelemetryEntity.js +35 -0
- package/dist/cache/entities/ServerTelemetryEntity.js.map +1 -0
- package/dist/cache/entities/ThrottlingEntity.js +32 -0
- package/dist/cache/entities/ThrottlingEntity.js.map +1 -0
- package/dist/cache/persistence/TokenCacheContext.js +39 -0
- package/dist/cache/persistence/TokenCacheContext.js.map +1 -0
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.js +388 -0
- package/dist/client/AuthorizationCodeClient.js.map +1 -0
- package/dist/client/BaseClient.d.ts +2 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.js +101 -0
- package/dist/client/BaseClient.js.map +1 -0
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.js +169 -0
- package/dist/client/ClientCredentialClient.js.map +1 -0
- package/dist/client/DeviceCodeClient.d.ts +6 -0
- package/dist/client/DeviceCodeClient.d.ts.map +1 -1
- package/dist/client/DeviceCodeClient.js +212 -0
- package/dist/client/DeviceCodeClient.js.map +1 -0
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.js +209 -0
- package/dist/client/OnBehalfOfClient.js.map +1 -0
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.js +212 -0
- package/dist/client/RefreshTokenClient.js.map +1 -0
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.js +132 -0
- package/dist/client/SilentFlowClient.js.map +1 -0
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.js +112 -0
- package/dist/client/UsernamePasswordClient.js.map +1 -0
- package/dist/config/ClientConfiguration.d.ts +3 -0
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.js +91 -0
- package/dist/config/ClientConfiguration.js.map +1 -0
- package/dist/crypto/ICrypto.js +53 -0
- package/dist/crypto/ICrypto.js.map +1 -0
- package/dist/crypto/PopTokenGenerator.js +72 -0
- package/dist/crypto/PopTokenGenerator.js.map +1 -0
- package/dist/error/AuthError.js +46 -0
- package/dist/error/AuthError.js.map +1 -0
- package/dist/error/ClientAuthError.d.ts +13 -6
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.js +456 -0
- package/dist/error/ClientAuthError.js.map +1 -0
- package/dist/error/ClientConfigurationError.d.ts +1 -6
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.js +210 -0
- package/dist/error/ClientConfigurationError.js.map +1 -0
- package/dist/error/InteractionRequiredAuthError.js +48 -0
- package/dist/error/InteractionRequiredAuthError.js.map +1 -0
- package/dist/error/ServerError.js +25 -0
- package/dist/error/ServerError.js.map +1 -0
- package/dist/index.cjs.js +7045 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -6479
- package/dist/index.js.map +1 -0
- package/dist/logger/Logger.d.ts +12 -3
- package/dist/logger/Logger.d.ts.map +1 -1
- package/dist/logger/Logger.js +183 -0
- package/dist/logger/Logger.js.map +1 -0
- package/dist/network/INetworkModule.d.ts +1 -1
- package/dist/network/INetworkModule.d.ts.map +1 -1
- package/dist/network/INetworkModule.js +21 -0
- package/dist/network/INetworkModule.js.map +1 -0
- package/dist/network/NetworkManager.js +56 -0
- package/dist/network/NetworkManager.js.map +1 -0
- package/dist/network/ThrottlingUtils.d.ts.map +1 -1
- package/dist/network/ThrottlingUtils.js +95 -0
- package/dist/network/ThrottlingUtils.js.map +1 -0
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +8 -0
- package/dist/packageMetadata.js.map +1 -0
- package/dist/request/CommonAuthorizationCodeRequest.d.ts +3 -0
- package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationUrlRequest.d.ts +1 -0
- package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/CommonClientCredentialRequest.d.ts +7 -4
- package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts +2 -0
- package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts +11 -0
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.js +340 -0
- package/dist/request/RequestParameterBuilder.js.map +1 -0
- package/dist/request/RequestValidator.d.ts.map +1 -1
- package/dist/request/RequestValidator.js +92 -0
- package/dist/request/RequestValidator.js.map +1 -0
- package/dist/request/ScopeSet.js +192 -0
- package/dist/request/ScopeSet.js.map +1 -0
- package/dist/response/AuthenticationResult.d.ts +1 -1
- package/dist/response/AuthenticationResult.d.ts.map +1 -1
- package/dist/response/AuthorizationCodePayload.d.ts +1 -0
- package/dist/response/AuthorizationCodePayload.d.ts.map +1 -1
- package/dist/response/IMDSBadResponse.d.ts +5 -0
- package/dist/response/IMDSBadResponse.d.ts.map +1 -0
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.js +281 -0
- package/dist/response/ResponseHandler.js.map +1 -0
- package/dist/telemetry/server/ServerTelemetryManager.d.ts +23 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.js +168 -0
- package/dist/telemetry/server/ServerTelemetryManager.js.map +1 -0
- package/dist/url/UrlString.d.ts +10 -0
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.js +223 -0
- package/dist/url/UrlString.js.map +1 -0
- package/dist/utils/Constants.d.ts +47 -4
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.js +362 -0
- package/dist/utils/Constants.js.map +1 -0
- package/dist/utils/ProtocolUtils.js +77 -0
- package/dist/utils/ProtocolUtils.js.map +1 -0
- package/dist/utils/StringUtils.d.ts +5 -0
- package/dist/utils/StringUtils.d.ts.map +1 -1
- package/dist/utils/StringUtils.js +128 -0
- package/dist/utils/StringUtils.js.map +1 -0
- package/dist/utils/TimeUtils.d.ts +13 -0
- package/dist/utils/TimeUtils.d.ts.map +1 -1
- package/dist/utils/TimeUtils.js +53 -0
- package/dist/utils/TimeUtils.js.map +1 -0
- package/package.json +10 -19
- package/dist/index.es.js +0 -6472
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SilentFlowClient.js","sources":["../../src/client/SilentFlowClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BaseClient } from \"./BaseClient\";\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\nimport { CommonSilentFlowRequest } from \"../request/CommonSilentFlowRequest\";\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\nimport { ScopeSet } from \"../request/ScopeSet\";\nimport { AuthToken } from \"../account/AuthToken\";\nimport { TimeUtils } from \"../utils/TimeUtils\";\nimport { RefreshTokenClient } from \"./RefreshTokenClient\";\nimport { ClientAuthError, ClientAuthErrorMessage } from \"../error/ClientAuthError\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { ResponseHandler } from \"../response/ResponseHandler\";\nimport { CacheRecord } from \"../cache/entities/CacheRecord\";\nimport { AuthenticationScheme, CacheOutcome } from \"../utils/Constants\";\nimport { StringUtils } from \"../utils/StringUtils\";\n\nexport class SilentFlowClient extends BaseClient {\n\n constructor(configuration: ClientConfiguration) {\n super(configuration);\n }\n\n /**\n * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew\n * the given token and returns the renewed token\n * @param request\n */\n async acquireToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult> {\n try {\n return await this.acquireCachedToken(request);\n } catch (e) {\n if (e instanceof ClientAuthError && e.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {\n const refreshTokenClient = new RefreshTokenClient(this.config);\n return refreshTokenClient.acquireTokenByRefreshToken(request);\n } else {\n throw e;\n }\n }\n }\n\n /**\n * Retrieves token from cache or throws an error if it must be refreshed.\n * @param request\n */\n async acquireCachedToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult> {\n // Cannot renew token if no request object is given.\n if (!request) {\n throw ClientConfigurationError.createEmptyTokenRequestError();\n }\n\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\n if (!request.account) {\n throw ClientAuthError.createNoAccountInSilentRequestError();\n }\n const requestScopes = new ScopeSet(request.scopes || []);\n const environment = request.authority || this.authority.getPreferredCache();\n const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;\n const cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, requestScopes, environment, authScheme);\n \n if (request.forceRefresh) {\n // Must refresh due to present force_refresh flag.\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.FORCE_REFRESH);\n throw ClientAuthError.createRefreshRequiredError();\n } else if (!cacheRecord.accessToken) {\n // Must refresh due to non-existent access_token.\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);\n throw ClientAuthError.createRefreshRequiredError();\n } else if (\n TimeUtils.wasClockTurnedBack(cacheRecord.accessToken.cachedAt) ||\n TimeUtils.isTokenExpired(cacheRecord.accessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)\n ) {\n // Must refresh due to expired access_token.\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);\n throw ClientAuthError.createRefreshRequiredError();\n } else if (cacheRecord.accessToken.refreshOn && TimeUtils.isTokenExpired(cacheRecord.accessToken.refreshOn, 0)) {\n // Must refresh due to the refresh_in value.\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.REFRESH_CACHED_ACCESS_TOKEN);\n throw ClientAuthError.createRefreshRequiredError();\n } else if (!StringUtils.isEmptyObj(request.claims)) {\n // Must refresh due to request parameters.\n throw ClientAuthError.createRefreshRequiredError();\n }\n\n if (this.config.serverTelemetryManager) {\n this.config.serverTelemetryManager.incrementCacheHits();\n }\n\n return await this.generateResultFromCacheRecord(cacheRecord, request);\n }\n\n /**\n * Helper function to build response object from the CacheRecord\n * @param cacheRecord\n */\n private async generateResultFromCacheRecord(cacheRecord: CacheRecord, request: CommonSilentFlowRequest): Promise<AuthenticationResult> {\n let idTokenObj: AuthToken | undefined;\n if (cacheRecord.idToken) {\n idTokenObj = new AuthToken(cacheRecord.idToken.secret, this.config.cryptoInterface);\n }\n return await ResponseHandler.generateAuthenticationResult(\n this.cryptoUtils,\n this.authority,\n cacheRecord,\n true,\n request,\n idTokenObj\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;;IAoBsC,oCAAU;IAE5C,0BAAY,aAAkC;eAC1C,kBAAM,aAAa,CAAC;KACvB;;;;;;IAOK,uCAAY,GAAlB,UAAmB,OAAgC;;;;;;;wBAEpC,qBAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAA;4BAA7C,sBAAO,SAAsC,EAAC;;;wBAE9C,IAAI,GAAC,YAAY,eAAe,IAAI,GAAC,CAAC,SAAS,KAAK,sBAAsB,CAAC,oBAAoB,CAAC,IAAI,EAAE;4BAC5F,kBAAkB,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;4BAC/D,sBAAO,kBAAkB,CAAC,0BAA0B,CAAC,OAAO,CAAC,EAAC;yBACjE;6BAAM;4BACH,MAAM,GAAC,CAAC;yBACX;;;;;KAER;;;;;IAMK,6CAAkB,GAAxB,UAAyB,OAAgC;;;;;;;;wBAErD,IAAI,CAAC,OAAO,EAAE;4BACV,MAAM,wBAAwB,CAAC,4BAA4B,EAAE,CAAC;yBACjE;;wBAGD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;4BAClB,MAAM,eAAe,CAAC,mCAAmC,EAAE,CAAC;yBAC/D;wBACK,aAAa,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;wBACnD,WAAW,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC;wBACtE,UAAU,GAAG,OAAO,CAAC,oBAAoB,IAAI,oBAAoB,CAAC,MAAM,CAAC;wBACzE,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,E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AI,CAAC,MAAM,CAAC,sBAAsB,CAAC,kBAAkB,EAAE,CAAC;yBAC3D;wBAEM,qBAAM,IAAI,CAAC,6BAA6B,CAAC,WAAW,EAAE,OAAO,CAAC,EAAA;4BAArE,sBAAO,SAA8D,EAAC;;;;KACzE;;;;;IAMa,wDAA6B,GAA3C,UAA4C,WAAwB,EAAE,OAAgC;;;;;;wBAElG,IAAI,WAAW,CAAC,OAAO,EAAE;4BACrB,UAAU,GAAG,IAAI,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;yBACvF;wBACM,qBAAM,eAAe,CAAC,4BAA4B,CACrD,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,SAAS,EACd,WAAW,EACX,IAAI,EACJ,OAAO,EACP,UAAU,CACb,EAAA;4BAPD,sBAAO,SAON,EAAC;;;;KACL;IACL,uBAAC;AAAD,CA5FA,CAAsC,UAAU;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UsernamePasswordClient.d.ts","sourceRoot":"","sources":["../../src/client/UsernamePasswordClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"UsernamePasswordClient.d.ts","sourceRoot":"","sources":["../../src/client/UsernamePasswordClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAYxE;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;gBAEtC,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAsBhG;;;;OAIG;YACW,mBAAmB;IAejC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CA2CjC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*! @azure/msal-common v4.5.1 2021-08-02 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
4
|
+
import { BaseClient } from './BaseClient.js';
|
|
5
|
+
import { ResponseHandler } from '../response/ResponseHandler.js';
|
|
6
|
+
import { RequestParameterBuilder } from '../request/RequestParameterBuilder.js';
|
|
7
|
+
import { GrantType } from '../utils/Constants.js';
|
|
8
|
+
import { StringUtils } from '../utils/StringUtils.js';
|
|
9
|
+
import { TimeUtils } from '../utils/TimeUtils.js';
|
|
10
|
+
import { CcsCredentialType } from '../account/CcsCredential.js';
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14
|
+
* Licensed under the MIT License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Oauth2.0 Password grant client
|
|
18
|
+
* Note: We are only supporting public clients for password grant and for purely testing purposes
|
|
19
|
+
*/
|
|
20
|
+
var UsernamePasswordClient = /** @class */ (function (_super) {
|
|
21
|
+
__extends(UsernamePasswordClient, _super);
|
|
22
|
+
function UsernamePasswordClient(configuration) {
|
|
23
|
+
return _super.call(this, configuration) || this;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* API to acquire a token by passing the username and password to the service in exchage of credentials
|
|
27
|
+
* password_grant
|
|
28
|
+
* @param request
|
|
29
|
+
*/
|
|
30
|
+
UsernamePasswordClient.prototype.acquireToken = function (request) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
32
|
+
var reqTimestamp, response, responseHandler, tokenResponse;
|
|
33
|
+
return __generator(this, function (_a) {
|
|
34
|
+
switch (_a.label) {
|
|
35
|
+
case 0:
|
|
36
|
+
this.logger.info("in acquireToken call");
|
|
37
|
+
reqTimestamp = TimeUtils.nowSeconds();
|
|
38
|
+
return [4 /*yield*/, this.executeTokenRequest(this.authority, request)];
|
|
39
|
+
case 1:
|
|
40
|
+
response = _a.sent();
|
|
41
|
+
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
42
|
+
// Validate response. This function throws a server error if an error is returned by the server.
|
|
43
|
+
responseHandler.validateTokenResponse(response.body);
|
|
44
|
+
tokenResponse = responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request);
|
|
45
|
+
return [2 /*return*/, tokenResponse];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Executes POST request to token endpoint
|
|
52
|
+
* @param authority
|
|
53
|
+
* @param request
|
|
54
|
+
*/
|
|
55
|
+
UsernamePasswordClient.prototype.executeTokenRequest = function (authority, request) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
+
var thumbprint, requestBody, headers;
|
|
58
|
+
return __generator(this, function (_a) {
|
|
59
|
+
thumbprint = {
|
|
60
|
+
clientId: this.config.authOptions.clientId,
|
|
61
|
+
authority: authority.canonicalAuthority,
|
|
62
|
+
scopes: request.scopes
|
|
63
|
+
};
|
|
64
|
+
requestBody = this.createTokenRequestBody(request);
|
|
65
|
+
headers = this.createTokenRequestHeaders({
|
|
66
|
+
credential: request.username,
|
|
67
|
+
type: CcsCredentialType.UPN
|
|
68
|
+
});
|
|
69
|
+
return [2 /*return*/, this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint)];
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Generates a map for all the params to be sent to the service
|
|
75
|
+
* @param request
|
|
76
|
+
*/
|
|
77
|
+
UsernamePasswordClient.prototype.createTokenRequestBody = function (request) {
|
|
78
|
+
var parameterBuilder = new RequestParameterBuilder();
|
|
79
|
+
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
80
|
+
parameterBuilder.addUsername(request.username);
|
|
81
|
+
parameterBuilder.addPassword(request.password);
|
|
82
|
+
parameterBuilder.addScopes(request.scopes);
|
|
83
|
+
parameterBuilder.addGrantType(GrantType.RESOURCE_OWNER_PASSWORD_GRANT);
|
|
84
|
+
parameterBuilder.addClientInfo();
|
|
85
|
+
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
86
|
+
parameterBuilder.addThrottling();
|
|
87
|
+
if (this.serverTelemetryManager) {
|
|
88
|
+
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
89
|
+
}
|
|
90
|
+
var correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
|
|
91
|
+
parameterBuilder.addCorrelationId(correlationId);
|
|
92
|
+
if (this.config.clientCredentials.clientSecret) {
|
|
93
|
+
parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
|
|
94
|
+
}
|
|
95
|
+
if (this.config.clientCredentials.clientAssertion) {
|
|
96
|
+
var clientAssertion = this.config.clientCredentials.clientAssertion;
|
|
97
|
+
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
98
|
+
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
99
|
+
}
|
|
100
|
+
if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
101
|
+
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
102
|
+
}
|
|
103
|
+
if (this.config.systemOptions.preventCorsPreflight && request.username) {
|
|
104
|
+
parameterBuilder.addCcsUpn(request.username);
|
|
105
|
+
}
|
|
106
|
+
return parameterBuilder.createQueryString();
|
|
107
|
+
};
|
|
108
|
+
return UsernamePasswordClient;
|
|
109
|
+
}(BaseClient));
|
|
110
|
+
|
|
111
|
+
export { UsernamePasswordClient };
|
|
112
|
+
//# sourceMappingURL=UsernamePasswordClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UsernamePasswordClient.js","sources":["../../src/client/UsernamePasswordClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BaseClient } from \"./BaseClient\";\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\nimport { CommonUsernamePasswordRequest } from \"../request/CommonUsernamePasswordRequest\";\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\nimport { ResponseHandler } from \"../response/ResponseHandler\";\nimport { Authority } from \"../authority/Authority\";\nimport { NetworkResponse } from \"../network/NetworkManager\";\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\nimport { GrantType } from \"../utils/Constants\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\nimport { TimeUtils } from \"../utils/TimeUtils\";\nimport { CcsCredentialType } from \"../account/CcsCredential\";\n\n/**\n * Oauth2.0 Password grant client\n * Note: We are only supporting public clients for password grant and for purely testing purposes\n */\nexport class UsernamePasswordClient extends BaseClient {\n\n constructor(configuration: ClientConfiguration) {\n super(configuration);\n }\n\n /**\n * API to acquire a token by passing the username and password to the service in exchage of credentials\n * password_grant\n * @param request\n */\n async acquireToken(request: CommonUsernamePasswordRequest): Promise<AuthenticationResult | null> {\n this.logger.info(\"in acquireToken call\");\n\n const reqTimestamp = TimeUtils.nowSeconds();\n const response = await this.executeTokenRequest(this.authority, request);\n\n const responseHandler = new ResponseHandler(\n this.config.authOptions.clientId,\n this.cacheManager,\n this.cryptoUtils,\n this.logger,\n this.config.serializableCache,\n this.config.persistencePlugin\n );\n\n // Validate response. This function throws a server error if an error is returned by the server.\n responseHandler.validateTokenResponse(response.body);\n const tokenResponse = responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request);\n\n return tokenResponse;\n }\n\n /**\n * Executes POST request to token endpoint\n * @param authority\n * @param request\n */\n private async executeTokenRequest(authority: Authority, request: CommonUsernamePasswordRequest): Promise<NetworkResponse<ServerAuthorizationTokenResponse>> {\n const thumbprint: RequestThumbprint = {\n clientId: this.config.authOptions.clientId,\n authority: authority.canonicalAuthority,\n scopes: request.scopes\n };\n const requestBody = this.createTokenRequestBody(request);\n const headers: Record<string, string> = this.createTokenRequestHeaders({\n credential: request.username,\n type: CcsCredentialType.UPN\n });\n\n return this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint);\n }\n\n /**\n * Generates a map for all the params to be sent to the service\n * @param request\n */\n private createTokenRequestBody(request: CommonUsernamePasswordRequest): string {\n const parameterBuilder = new RequestParameterBuilder();\n\n parameterBuilder.addClientId(this.config.authOptions.clientId);\n parameterBuilder.addUsername(request.username);\n parameterBuilder.addPassword(request.password);\n\n parameterBuilder.addScopes(request.scopes);\n\n parameterBuilder.addGrantType(GrantType.RESOURCE_OWNER_PASSWORD_GRANT);\n parameterBuilder.addClientInfo();\n\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\n\n parameterBuilder.addThrottling();\n\n if (this.serverTelemetryManager) {\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\n }\n\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\n parameterBuilder.addCorrelationId(correlationId);\n\n if (this.config.clientCredentials.clientSecret) {\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\n }\n\n if (this.config.clientCredentials.clientAssertion) {\n const clientAssertion = this.config.clientCredentials.clientAssertion;\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\n }\n\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\n }\n\n if (this.config.systemOptions.preventCorsPreflight && request.username) {\n parameterBuilder.addCcsUpn(request.username);\n }\n\n return parameterBuilder.createQueryString();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;AAoBA;;;;;IAI4C,0CAAU;IAElD,gCAAY,aAAkC;eAC1C,kBAAM,aAAa,CAAC;KACvB;;;;;;IAOK,6CAAY,GAAlB,UAAmB,OAAsC;;;;;;wBACrD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;wBAEnC,YAAY,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;wBAC3B,qBAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAA;;wBAAlE,QAAQ,GAAG,SAAuD;wBAElE,eAAe,GAAG,IAAI,eAAe,CACvC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAChC,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAC7B,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAChC,CAAC;;wBAGF,eAAe,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;wBAC/C,aAAa,GAAG,eAAe,CAAC,yBAAyB,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;wBAEtH,sBAAO,aAAa,EAAC;;;;KACxB;;;;;;IAOa,oDAAmB,GAAjC,UAAkC,SAAoB,EAAE,OAAsC;;;;gBACpF,UAAU,GAAsB;oBAClC,QAAQ,E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70
|
+
preventCorsPreflight?: boolean;
|
|
70
71
|
};
|
|
71
72
|
/**
|
|
72
73
|
* Use this to configure the logging that MSAL does, by configuring logger options in the Configuration object
|
|
@@ -74,11 +75,13 @@ export declare type SystemOptions = {
|
|
|
74
75
|
* - loggerCallback - Callback for logger
|
|
75
76
|
* - piiLoggingEnabled - Sets whether pii logging is enabled
|
|
76
77
|
* - logLevel - Sets the level at which logging happens
|
|
78
|
+
* - correlationId - Sets the correlationId printed by the logger
|
|
77
79
|
*/
|
|
78
80
|
export declare type LoggerOptions = {
|
|
79
81
|
loggerCallback?: ILoggerCallback;
|
|
80
82
|
piiLoggingEnabled?: boolean;
|
|
81
83
|
logLevel?: LogLevel;
|
|
84
|
+
correlationId?: string;
|
|
82
85
|
};
|
|
83
86
|
/**
|
|
84
87
|
* Library-specific options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientConfiguration.d.ts","sourceRoot":"","sources":["../../src/config/ClientConfiguration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAiC,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAuB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAKrF;;;;;;;;;;;;GAYG;AACH,oBAAY,mBAAmB,GAAG;IAC9B,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,gBAAgB,CA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BAAgB,EAC/B,gBAAgB,EAAE,qBAAqB,EACvC,gBAAgB,EAAE,qBAAqB,EACvC,eAAe,EAAE,oBAAoB,EACrC,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,sBAAsB,EAAE,sBAAsB,EAC9C,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACvC,EAAE,mBAAmB,GAAG,yBAAyB,CAerD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*! @azure/msal-common v4.5.1 2021-08-02 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
4
|
+
import { DEFAULT_CRYPTO_IMPLEMENTATION } from '../crypto/ICrypto.js';
|
|
5
|
+
import { AuthError } from '../error/AuthError.js';
|
|
6
|
+
import { LogLevel } from '../logger/Logger.js';
|
|
7
|
+
import { Constants } from '../utils/Constants.js';
|
|
8
|
+
import { version } from '../packageMetadata.js';
|
|
9
|
+
import { DefaultStorageClass } from '../cache/CacheManager.js';
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13
|
+
* Licensed under the MIT License.
|
|
14
|
+
*/
|
|
15
|
+
// Token renewal offset default in seconds
|
|
16
|
+
var DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
17
|
+
var DEFAULT_SYSTEM_OPTIONS = {
|
|
18
|
+
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
19
|
+
preventCorsPreflight: false
|
|
20
|
+
};
|
|
21
|
+
var DEFAULT_LOGGER_IMPLEMENTATION = {
|
|
22
|
+
loggerCallback: function () {
|
|
23
|
+
// allow users to not set loggerCallback
|
|
24
|
+
},
|
|
25
|
+
piiLoggingEnabled: false,
|
|
26
|
+
logLevel: LogLevel.Info,
|
|
27
|
+
correlationId: ""
|
|
28
|
+
};
|
|
29
|
+
var DEFAULT_NETWORK_IMPLEMENTATION = {
|
|
30
|
+
sendGetRequestAsync: function () {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
32
|
+
var notImplErr;
|
|
33
|
+
return __generator(this, function (_a) {
|
|
34
|
+
notImplErr = "Network interface - sendGetRequestAsync() has not been implemented";
|
|
35
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
sendPostRequestAsync: function () {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
41
|
+
var notImplErr;
|
|
42
|
+
return __generator(this, function (_a) {
|
|
43
|
+
notImplErr = "Network interface - sendPostRequestAsync() has not been implemented";
|
|
44
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var DEFAULT_LIBRARY_INFO = {
|
|
50
|
+
sku: Constants.SKU,
|
|
51
|
+
version: version,
|
|
52
|
+
cpu: "",
|
|
53
|
+
os: ""
|
|
54
|
+
};
|
|
55
|
+
var DEFAULT_CLIENT_CREDENTIALS = {
|
|
56
|
+
clientSecret: "",
|
|
57
|
+
clientAssertion: undefined
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Function that sets the default options when not explicitly configured from app developer
|
|
61
|
+
*
|
|
62
|
+
* @param Configuration
|
|
63
|
+
*
|
|
64
|
+
* @returns Configuration
|
|
65
|
+
*/
|
|
66
|
+
function buildClientConfiguration(_a) {
|
|
67
|
+
var userAuthOptions = _a.authOptions, userSystemOptions = _a.systemOptions, userLoggerOption = _a.loggerOptions, storageImplementation = _a.storageInterface, networkImplementation = _a.networkInterface, cryptoImplementation = _a.cryptoInterface, clientCredentials = _a.clientCredentials, libraryInfo = _a.libraryInfo, serverTelemetryManager = _a.serverTelemetryManager, persistencePlugin = _a.persistencePlugin, serializableCache = _a.serializableCache;
|
|
68
|
+
return {
|
|
69
|
+
authOptions: buildAuthOptions(userAuthOptions),
|
|
70
|
+
systemOptions: __assign(__assign({}, DEFAULT_SYSTEM_OPTIONS), userSystemOptions),
|
|
71
|
+
loggerOptions: __assign(__assign({}, DEFAULT_LOGGER_IMPLEMENTATION), userLoggerOption),
|
|
72
|
+
storageInterface: storageImplementation || new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION),
|
|
73
|
+
networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
|
|
74
|
+
cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
75
|
+
clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
|
|
76
|
+
libraryInfo: __assign(__assign({}, DEFAULT_LIBRARY_INFO), libraryInfo),
|
|
77
|
+
serverTelemetryManager: serverTelemetryManager || null,
|
|
78
|
+
persistencePlugin: persistencePlugin || null,
|
|
79
|
+
serializableCache: serializableCache || null
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Construct authoptions from the client and platform passed values
|
|
84
|
+
* @param authOptions
|
|
85
|
+
*/
|
|
86
|
+
function buildAuthOptions(authOptions) {
|
|
87
|
+
return __assign({ clientCapabilities: [] }, authOptions);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { DEFAULT_SYSTEM_OPTIONS, buildClientConfiguration };
|
|
91
|
+
//# sourceMappingURL=ClientConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientConfiguration.js","sources":["../../src/config/ClientConfiguration.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { INetworkModule } from \"../network/INetworkModule\";\nimport { DEFAULT_CRYPTO_IMPLEMENTATION, ICrypto } from \"../crypto/ICrypto\";\nimport { AuthError } from \"../error/AuthError\";\nimport { ILoggerCallback, LogLevel } from \"../logger/Logger\";\nimport { Constants } from \"../utils/Constants\";\nimport { version } from \"../packageMetadata\";\nimport { Authority } from \"../authority/Authority\";\nimport { CacheManager, DefaultStorageClass } from \"../cache/CacheManager\";\nimport { ServerTelemetryManager } from \"../telemetry/server/ServerTelemetryManager\";\nimport { ICachePlugin } from \"../cache/interface/ICachePlugin\";\nimport { ISerializableTokenCache } from \"../cache/interface/ISerializableTokenCache\";\n\n// Token renewal offset default in seconds\nconst DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;\n\n/**\n * Use the configuration object to configure MSAL Modules and initialize the base interfaces for MSAL.\n *\n * This object allows you to configure important elements of MSAL functionality:\n * - authOptions - Authentication for application\n * - cryptoInterface - Implementation of crypto functions\n * - libraryInfo - Library metadata\n * - loggerOptions - Logging for application\n * - networkInterface - Network implementation\n * - storageInterface - Storage implementation\n * - systemOptions - Additional library options\n * - clientCredentials - Credentials options for confidential clients\n */\nexport type ClientConfiguration = {\n authOptions: AuthOptions,\n systemOptions?: SystemOptions,\n loggerOptions?: LoggerOptions,\n storageInterface?: CacheManager,\n networkInterface?: INetworkModule,\n cryptoInterface?: ICrypto,\n clientCredentials?: ClientCredentials,\n libraryInfo?: LibraryInfo\n serverTelemetryManager?: ServerTelemetryManager | null,\n persistencePlugin?: ICachePlugin | null,\n serializableCache?: ISerializableTokenCache | null\n};\n\nexport type CommonClientConfiguration = {\n authOptions: Required<AuthOptions>,\n systemOptions: Required<SystemOptions>,\n loggerOptions : Required<LoggerOptions>,\n storageInterface: CacheManager,\n networkInterface : INetworkModule,\n cryptoInterface : Required<ICrypto>,\n libraryInfo : LibraryInfo,\n serverTelemetryManager: ServerTelemetryManager | null,\n clientCredentials: ClientCredentials,\n persistencePlugin: ICachePlugin | null,\n serializableCache: ISerializableTokenCache | null\n};\n\n/**\n * Use this to configure the auth options in the ClientConfiguration object\n *\n * - clientId - Client ID of your app registered with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview in Microsoft Identity Platform\n * - authority - You can configure a specific authority, defaults to \" \" or \"https://login.microsoftonline.com/common\"\n * - knownAuthorities - An array of URIs that are known to be valid. Used in B2C scenarios.\n * - cloudDiscoveryMetadata - A string containing the cloud discovery response. Used in AAD scenarios.\n * - clientCapabilities - Array of capabilities which will be added to the claims.access_token.xms_cc request property on every network request.\n * - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.\n */\nexport type AuthOptions = {\n clientId: string;\n authority: Authority;\n clientCapabilities?: Array<string>;\n};\n\n/**\n * Use this to configure token renewal info in the Configuration object\n *\n * - tokenRenewalOffsetSeconds - Sets the window of offset needed to renew the token before expiry\n */\nexport type SystemOptions = {\n tokenRenewalOffsetSeconds?: number;\n preventCorsPreflight?: boolean;\n};\n\n/**\n * Use this to configure the logging that MSAL does, by configuring logger options in the Configuration object\n *\n * - loggerCallback - Callback for logger\n * - piiLoggingEnabled - Sets whether pii logging is enabled\n * - logLevel - Sets the level at which logging happens\n * - correlationId - Sets the correlationId printed by the logger\n */\nexport type LoggerOptions = {\n loggerCallback?: ILoggerCallback,\n piiLoggingEnabled?: boolean,\n logLevel?: LogLevel,\n correlationId?: string\n};\n\n/**\n * Library-specific options\n */\nexport type LibraryInfo = {\n sku: string,\n version: string,\n cpu: string,\n os: string\n};\n\n/**\n * Credentials for confidential clients\n */\nexport type ClientCredentials = {\n clientSecret?: string,\n clientAssertion? : {\n assertion: string,\n assertionType: string\n };\n};\n\nexport const DEFAULT_SYSTEM_OPTIONS: Required<SystemOptions> = {\n tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,\n preventCorsPreflight: false\n};\n\nconst DEFAULT_LOGGER_IMPLEMENTATION: Required<LoggerOptions> = {\n loggerCallback: () => {\n // allow users to not set loggerCallback\n },\n piiLoggingEnabled: false,\n logLevel: LogLevel.Info,\n correlationId: \"\"\n};\n\nconst DEFAULT_NETWORK_IMPLEMENTATION: INetworkModule = {\n async sendGetRequestAsync<T>(): Promise<T> {\n const notImplErr = \"Network interface - sendGetRequestAsync() has not been implemented\";\n throw AuthError.createUnexpectedError(notImplErr);\n },\n async sendPostRequestAsync<T>(): Promise<T> {\n const notImplErr = \"Network interface - sendPostRequestAsync() has not been implemented\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n};\n\nconst DEFAULT_LIBRARY_INFO: LibraryInfo = {\n sku: Constants.SKU,\n version: version,\n cpu: \"\",\n os: \"\"\n};\n\nconst DEFAULT_CLIENT_CREDENTIALS: ClientCredentials = {\n clientSecret: \"\",\n clientAssertion: undefined\n};\n\n/**\n * Function that sets the default options when not explicitly configured from app developer\n *\n * @param Configuration\n *\n * @returns Configuration\n */\nexport function buildClientConfiguration(\n {\n authOptions: userAuthOptions,\n systemOptions: userSystemOptions,\n loggerOptions: userLoggerOption,\n storageInterface: storageImplementation,\n networkInterface: networkImplementation,\n cryptoInterface: cryptoImplementation,\n clientCredentials: clientCredentials,\n libraryInfo: libraryInfo,\n serverTelemetryManager: serverTelemetryManager,\n persistencePlugin: persistencePlugin,\n serializableCache: serializableCache\n }: ClientConfiguration): CommonClientConfiguration {\n\n return {\n authOptions: buildAuthOptions(userAuthOptions),\n systemOptions: { ...DEFAULT_SYSTEM_OPTIONS, ...userSystemOptions },\n loggerOptions: { ...DEFAULT_LOGGER_IMPLEMENTATION, ...userLoggerOption },\n storageInterface: storageImplementation || new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION),\n networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,\n cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,\n clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,\n libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },\n serverTelemetryManager: serverTelemetryManager || null,\n persistencePlugin: persistencePlugin || null,\n serializableCache: serializableCache || null\n };\n}\n\n/**\n * Construct authoptions from the client and platform passed values\n * @param authOptions\n */\nfunction buildAuthOptions(authOptions: AuthOptions): Required<AuthOptions> {\n return {\n clientCapabilities: [],\n ...authOptions\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;AAiBA;AACA,IAAM,gCAAgC,GAAG,GAAG,CAAC;IAyGhC,sBAAsB,GAA4B;IAC3D,yBAAyB,EAAE,gCAAgC;IAC3D,oBAAoB,EAAE,KAAK;EAC7B;AAEF,IAAM,6BAA6B,GAA4B;IAC3D,cAAc,EAAE;;KAEf;IACD,iBAAiB,EAAE,KAAK;IACxB,QAAQ,EAAE,QAAQ,CAAC,IAAI;IACvB,aAAa,EAAE,EAAE;CACpB,CAAC;AAEF,IAAM,8BAA8B,GAAmB;IAC7C,mBAAmB,EAAzB;;;;gBACU,UAAU,GAAG,oEAAoE,CAAC;gBACxF,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;;;KACrD;IACK,oBAAoB,EAA1B;;;;gBACU,UAAU,GAAG,qEAAqE,CAAC;gBACzF,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;;;KACrD;CACJ,CAAC;AAEF,IAAM,oBAAoB,GAAgB;IACtC,GAAG,EAAE,SAAS,CAAC,GAAG;IAClB,OAAO,EAAE,OAAO;IAChB,GAAG,EAAE,EAAE;IACP,EAAE,EAAE,EAAE;CACT,CAAC;AAEF,IAAM,0BAA0B,GAAsB;IAClD,YAAY,EAAE,EAAE;IAChB,eAAe,EAAE,SAAS;CAC7B,CAAC;AAEF;;;;;;;SAOgB,wBAAwB,CACpC,EAYsB;QAXL,eAAe,iBAAA,EACb,iBAAiB,mBAAA,EACjB,gBAAgB,mBAAA,EACb,qBAAqB,sBAAA,EACrB,qBAAqB,sBAAA,EACtB,oBAAoB,qBAAA,EAClB,iBAAiB,uBAAA,EACvB,WAAW,iBAAA,EACA,sBAAsB,4BAAA,EAC3B,iBAAiB,uBAAA,EACjB,iBAAiB,uBAAA;IAGxC,OAAO;QACH,WAAW,EAAE,gBAAgB,CAAC,eAAe,CAAC;QAC9C,aAAa,wBAAO,sBAAsB,GAAK,iBAAiB,CAAE;QAClE,aAAa,wBAAO,6BAA6B,GAAK,gBAAgB,CAAE;QACxE,gBAAgB,EAAE,qBAAqB,IAAI,IAAI,mBAAmB,CAAC,eAAe,CAAC,QAAQ,EAAE,6BAA6B,CAAC;QAC3H,gBAAgB,EAAE,qBAAqB,IAAI,8BAA8B;QACzE,eAAe,EAAE,oBAAoB,IAAI,6BAA6B;QACtE,iBAAiB,EAAE,iBAAiB,IAAI,0BAA0B;QAClE,WAAW,wBAAO,oBAAoB,GAAK,WAAW,CAAE;QACxD,sBAAsB,EAAE,sBAAsB,IAAI,IAAI;QACtD,iBAAiB,EAAE,iBAAiB,IAAI,IAAI;QAC5C,iBAAiB,EAAE,iBAAiB,IAAI,IAAI;KAC/C,CAAC;AACN,CAAC;AAED;;;;AAIA,SAAS,gBAAgB,CAAC,WAAwB;IAC9C,kBACI,kBAAkB,EAAE,EAAE,IACnB,WAAW,EAChB;AACN;;;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*! @azure/msal-common v4.5.1 2021-08-02 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
4
|
+
import { AuthError } from '../error/AuthError.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
+
* Licensed under the MIT License.
|
|
9
|
+
*/
|
|
10
|
+
var DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
11
|
+
createNewGuid: function () {
|
|
12
|
+
var notImplErr = "Crypto interface - createNewGuid() has not been implemented";
|
|
13
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
14
|
+
},
|
|
15
|
+
base64Decode: function () {
|
|
16
|
+
var notImplErr = "Crypto interface - base64Decode() has not been implemented";
|
|
17
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
18
|
+
},
|
|
19
|
+
base64Encode: function () {
|
|
20
|
+
var notImplErr = "Crypto interface - base64Encode() has not been implemented";
|
|
21
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
22
|
+
},
|
|
23
|
+
generatePkceCodes: function () {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25
|
+
var notImplErr;
|
|
26
|
+
return __generator(this, function (_a) {
|
|
27
|
+
notImplErr = "Crypto interface - generatePkceCodes() has not been implemented";
|
|
28
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
getPublicKeyThumbprint: function () {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
34
|
+
var notImplErr;
|
|
35
|
+
return __generator(this, function (_a) {
|
|
36
|
+
notImplErr = "Crypto interface - getPublicKeyThumbprint() has not been implemented";
|
|
37
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
signJwt: function () {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
+
var notImplErr;
|
|
44
|
+
return __generator(this, function (_a) {
|
|
45
|
+
notImplErr = "Crypto interface - signJwt() has not been implemented";
|
|
46
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { DEFAULT_CRYPTO_IMPLEMENTATION };
|
|
53
|
+
//# sourceMappingURL=ICrypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICrypto.js","sources":["../../src/crypto/ICrypto.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthError } from \"../error/AuthError\";\nimport { BaseAuthRequest } from \"../request/BaseAuthRequest\";\nimport { SignedHttpRequest } from \"./SignedHttpRequest\";\n\n/**\n * The PkceCodes type describes the structure\n * of objects that contain PKCE code\n * challenge and verifier pairs\n */\nexport type PkceCodes = {\n verifier: string,\n challenge: string\n};\n\n/**\n * Interface for crypto functions used by library\n */\nexport interface ICrypto {\n /**\n * Creates a guid randomly.\n */\n createNewGuid(): string;\n /**\n * base64 Encode string\n * @param input \n */\n base64Encode(input: string): string;\n /**\n * base64 decode string\n * @param input \n */\n base64Decode(input: string): string;\n /**\n * Generate PKCE codes for OAuth. See RFC here: https://tools.ietf.org/html/rfc7636\n */\n generatePkceCodes(): Promise<PkceCodes>;\n /**\n * Generates an JWK RSA S256 Thumbprint\n * @param request\n */\n getPublicKeyThumbprint(request: BaseAuthRequest): Promise<string>;\n /** \n * Returns a signed proof-of-possession token with a given acces token that contains a cnf claim with the required kid.\n * @param accessToken \n */\n signJwt(payload: SignedHttpRequest, kid: string): Promise<string>;\n}\n\nexport const DEFAULT_CRYPTO_IMPLEMENTATION: ICrypto = {\n createNewGuid: (): string => {\n const notImplErr = \"Crypto interface - createNewGuid() has not been implemented\";\n throw AuthError.createUnexpectedError(notImplErr);\n },\n base64Decode: (): string => {\n const notImplErr = \"Crypto interface - base64Decode() has not been implemented\";\n throw AuthError.createUnexpectedError(notImplErr);\n },\n base64Encode: (): string => {\n const notImplErr = \"Crypto interface - base64Encode() has not been implemented\";\n throw AuthError.createUnexpectedError(notImplErr);\n },\n async generatePkceCodes(): Promise<PkceCodes> {\n const notImplErr = \"Crypto interface - generatePkceCodes() has not been implemented\";\n throw AuthError.createUnexpectedError(notImplErr);\n },\n async getPublicKeyThumbprint(): Promise<string> {\n const notImplErr = \"Crypto interface - getPublicKeyThumbprint() has not been implemented\";\n throw AuthError.createUnexpectedError(notImplErr);\n },\n async signJwt(): Promise<string> {\n const notImplErr = \"Crypto interface - signJwt() has not been implemented\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n};\n"],"names":[],"mappings":";;;;;AAAA;;;;IAqDa,6BAA6B,GAAY;IAClD,aAAa,EAAE;QACX,IAAM,UAAU,GAAG,6DAA6D,CAAC;QACjF,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;KACrD;IACD,YAAY,EAAE;QACV,IAAM,UAAU,GAAG,4DAA4D,CAAC;QAChF,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;KACrD;IACD,YAAY,EAAE;QACV,IAAM,UAAU,GAAG,4DAA4D,CAAC;QAChF,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;KACrD;IACK,iBAAiB,EAAvB;;;;gBACU,UAAU,GAAG,iEAAiE,CAAC;gBACrF,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;;;KACrD;IACK,sBAAsB,EAA5B;;;;gBACU,UAAU,GAAG,sEAAsE,CAAC;gBAC1F,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;;;KACrD;IACK,OAAO,EAAb;;;;gBACU,UAAU,GAAG,uDAAuD,CAAC;gBAC3E,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;;;KACrD;;;;;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*! @azure/msal-common v4.5.1 2021-08-02 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
4
|
+
import { AuthToken } from '../account/AuthToken.js';
|
|
5
|
+
import { TimeUtils } from '../utils/TimeUtils.js';
|
|
6
|
+
import { UrlString } from '../url/UrlString.js';
|
|
7
|
+
import { ClientAuthError } from '../error/ClientAuthError.js';
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11
|
+
* Licensed under the MIT License.
|
|
12
|
+
*/
|
|
13
|
+
var KeyLocation;
|
|
14
|
+
(function (KeyLocation) {
|
|
15
|
+
KeyLocation["SW"] = "sw";
|
|
16
|
+
KeyLocation["UHW"] = "uhw";
|
|
17
|
+
})(KeyLocation || (KeyLocation = {}));
|
|
18
|
+
var PopTokenGenerator = /** @class */ (function () {
|
|
19
|
+
function PopTokenGenerator(cryptoUtils) {
|
|
20
|
+
this.cryptoUtils = cryptoUtils;
|
|
21
|
+
}
|
|
22
|
+
PopTokenGenerator.prototype.generateCnf = function (request) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24
|
+
var kidThumbprint, reqCnf;
|
|
25
|
+
return __generator(this, function (_a) {
|
|
26
|
+
switch (_a.label) {
|
|
27
|
+
case 0: return [4 /*yield*/, this.cryptoUtils.getPublicKeyThumbprint(request)];
|
|
28
|
+
case 1:
|
|
29
|
+
kidThumbprint = _a.sent();
|
|
30
|
+
reqCnf = {
|
|
31
|
+
kid: kidThumbprint,
|
|
32
|
+
xms_ksl: KeyLocation.SW
|
|
33
|
+
};
|
|
34
|
+
return [2 /*return*/, this.cryptoUtils.base64Encode(JSON.stringify(reqCnf))];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
PopTokenGenerator.prototype.signPopToken = function (accessToken, request) {
|
|
40
|
+
var _a;
|
|
41
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
42
|
+
var tokenClaims, resourceRequestMethod, resourceRequestUri, shrClaims, resourceUrlString, resourceUrlComponents;
|
|
43
|
+
return __generator(this, function (_b) {
|
|
44
|
+
switch (_b.label) {
|
|
45
|
+
case 0:
|
|
46
|
+
tokenClaims = AuthToken.extractTokenClaims(accessToken, this.cryptoUtils);
|
|
47
|
+
resourceRequestMethod = request.resourceRequestMethod, resourceRequestUri = request.resourceRequestUri, shrClaims = request.shrClaims;
|
|
48
|
+
resourceUrlString = (resourceRequestUri) ? new UrlString(resourceRequestUri) : undefined;
|
|
49
|
+
resourceUrlComponents = resourceUrlString === null || resourceUrlString === void 0 ? void 0 : resourceUrlString.getUrlComponents();
|
|
50
|
+
if (!((_a = tokenClaims === null || tokenClaims === void 0 ? void 0 : tokenClaims.cnf) === null || _a === void 0 ? void 0 : _a.kid)) {
|
|
51
|
+
throw ClientAuthError.createTokenClaimsRequiredError();
|
|
52
|
+
}
|
|
53
|
+
return [4 /*yield*/, this.cryptoUtils.signJwt({
|
|
54
|
+
at: accessToken,
|
|
55
|
+
ts: TimeUtils.nowSeconds(),
|
|
56
|
+
m: resourceRequestMethod === null || resourceRequestMethod === void 0 ? void 0 : resourceRequestMethod.toUpperCase(),
|
|
57
|
+
u: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.HostNameAndPort,
|
|
58
|
+
nonce: this.cryptoUtils.createNewGuid(),
|
|
59
|
+
p: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.AbsolutePath,
|
|
60
|
+
q: (resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.QueryString) ? [[], resourceUrlComponents.QueryString] : undefined,
|
|
61
|
+
client_claims: shrClaims || undefined
|
|
62
|
+
}, tokenClaims.cnf.kid)];
|
|
63
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
return PopTokenGenerator;
|
|
69
|
+
}());
|
|
70
|
+
|
|
71
|
+
export { PopTokenGenerator };
|
|
72
|
+
//# sourceMappingURL=PopTokenGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopTokenGenerator.js","sources":["../../src/crypto/PopTokenGenerator.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICrypto } from \"./ICrypto\";\nimport { AuthToken } from \"../account/AuthToken\";\nimport { TokenClaims } from \"../account/TokenClaims\";\nimport { TimeUtils } from \"../utils/TimeUtils\";\nimport { UrlString } from \"../url/UrlString\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { BaseAuthRequest } from \"../request/BaseAuthRequest\";\n\n/**\n * See eSTS docs for more info.\n * - A kid element, with the value containing an RFC 7638-compliant JWK thumbprint that is base64 encoded.\n * - xms_ksl element, representing the storage location of the key's secret component on the client device. One of two values:\n * - sw: software storage\n * - uhw: hardware storage\n */\ntype ReqCnf = {\n kid: string;\n xms_ksl: KeyLocation;\n};\n\nenum KeyLocation {\n SW = \"sw\",\n UHW = \"uhw\"\n}\n\nexport class PopTokenGenerator {\n\n private cryptoUtils: ICrypto;\n\n constructor(cryptoUtils: ICrypto) {\n this.cryptoUtils = cryptoUtils;\n }\n\n async generateCnf(request: BaseAuthRequest): Promise<string> {\n const kidThumbprint = await this.cryptoUtils.getPublicKeyThumbprint(request);\n const reqCnf: ReqCnf = {\n kid: kidThumbprint,\n xms_ksl: KeyLocation.SW\n };\n return this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));\n }\n\n async signPopToken(accessToken: string, request: BaseAuthRequest): Promise<string> {\n const tokenClaims: TokenClaims | null = AuthToken.extractTokenClaims(accessToken, this.cryptoUtils);\n\n // Deconstruct request to extract SHR parameters\n const { resourceRequestMethod, resourceRequestUri, shrClaims } = request;\n\n const resourceUrlString = (resourceRequestUri) ? new UrlString(resourceRequestUri) : undefined;\n const resourceUrlComponents = resourceUrlString?.getUrlComponents();\n\n if (!tokenClaims?.cnf?.kid) {\n throw ClientAuthError.createTokenClaimsRequiredError();\n }\n\n return await this.cryptoUtils.signJwt({\n at: accessToken,\n ts: TimeUtils.nowSeconds(),\n m: resourceRequestMethod?.toUpperCase(),\n u: resourceUrlComponents?.HostNameAndPort,\n nonce: this.cryptoUtils.createNewGuid(),\n p: resourceUrlComponents?.AbsolutePath,\n q: (resourceUrlComponents?.QueryString) ? [[], resourceUrlComponents.QueryString] : undefined,\n client_claims: shrClaims || undefined\n }, tokenClaims.cnf.kid);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;AAyBA,IAAK,WAGJ;AAHD,WAAK,WAAW;IACZ,wBAAS,C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AqB,CAAE,WAAW,EAAE;gCACvC,CAAC,EAAE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,eAAe;gCACzC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE;gCACvC,CAAC,EAAE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,YAAY;gCACtC,CAAC,EAAE,CAAC,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,WAAW,IAAI,CAAC,EAAE,EAAE,qBAAqB,CAAC,WAAW,CAAC,GAAG,SAAS;gCAC7F,aAAa,EAAE,SAAS,IAAI,SAAS;6BACxC,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAA;4BATvB,sBAAO,SASgB,EAAC;;;;KAC3B;IACL,wBAAC;AAAD,CAAC;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*! @azure/msal-common v4.5.1 2021-08-02 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { __extends } from '../_virtual/_tslib.js';
|
|
4
|
+
import { Constants } from '../utils/Constants.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
+
* Licensed under the MIT License.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* AuthErrorMessage class containing string constants used by error codes and messages.
|
|
12
|
+
*/
|
|
13
|
+
var AuthErrorMessage = {
|
|
14
|
+
unexpectedError: {
|
|
15
|
+
code: "unexpected_error",
|
|
16
|
+
desc: "Unexpected error in authentication."
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* General error class thrown by the MSAL.js library.
|
|
21
|
+
*/
|
|
22
|
+
var AuthError = /** @class */ (function (_super) {
|
|
23
|
+
__extends(AuthError, _super);
|
|
24
|
+
function AuthError(errorCode, errorMessage, suberror) {
|
|
25
|
+
var _this = this;
|
|
26
|
+
var errorString = errorMessage ? errorCode + ": " + errorMessage : errorCode;
|
|
27
|
+
_this = _super.call(this, errorString) || this;
|
|
28
|
+
Object.setPrototypeOf(_this, AuthError.prototype);
|
|
29
|
+
_this.errorCode = errorCode || Constants.EMPTY_STRING;
|
|
30
|
+
_this.errorMessage = errorMessage || "";
|
|
31
|
+
_this.subError = suberror || "";
|
|
32
|
+
_this.name = "AuthError";
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates an error that is thrown when something unexpected happens in the library.
|
|
37
|
+
* @param errDesc
|
|
38
|
+
*/
|
|
39
|
+
AuthError.createUnexpectedError = function (errDesc) {
|
|
40
|
+
return new AuthError(AuthErrorMessage.unexpectedError.code, AuthErrorMessage.unexpectedError.desc + ": " + errDesc);
|
|
41
|
+
};
|
|
42
|
+
return AuthError;
|
|
43
|
+
}(Error));
|
|
44
|
+
|
|
45
|
+
export { AuthError, AuthErrorMessage };
|
|
46
|
+
//# sourceMappingURL=AuthError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthError.js","sources":["../../src/error/AuthError.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Constants } from \"../utils/Constants\";\n\n/**\n * AuthErrorMessage class containing string constants used by error codes and messages.\n */\nexport const AuthErrorMessage = {\n unexpectedError: {\n code: \"unexpected_error\",\n desc: \"Unexpected error in authentication.\"\n }\n};\n\n/**\n * General error class thrown by the MSAL.js library.\n */\nexport class AuthError extends Error {\n\n /**\n * Short string denoting error\n */\n errorCode: string;\n\n /**\n * Detailed description of error\n */\n errorMessage: string;\n\n /**\n * Describes the subclass of an error\n */\n subError: string;\n\n constructor(errorCode?: string, errorMessage?: string, suberror?: string) {\n const errorString = errorMessage ? `${errorCode}: ${errorMessage}` : errorCode;\n super(errorString);\n Object.setPrototypeOf(this, AuthError.prototype);\n\n this.errorCode = errorCode || Constants.EMPTY_STRING;\n this.errorMessage = errorMessage || \"\";\n this.subError = suberror || \"\";\n this.name = \"AuthError\";\n }\n\n /**\n * Creates an error that is thrown when something unexpected happens in the library.\n * @param errDesc\n */\n static createUnexpectedError(errDesc: string): AuthError {\n return new AuthError(AuthErrorMessage.unexpectedError.code, `${AuthErrorMessage.unexpectedError.desc}: ${errDesc}`);\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;AAOA;;;IAGa,gBAAgB,GAAG;IAC5B,eAAe,EAAE;QACb,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,qCAAqC;KAC9C;EACH;AAEF;;;;IAG+B,6BAAK;IAiBhC,mBAAY,SAAkB,EAAE,YAAqB,EAAE,QAAiB;QAAxE,iBASC;QARG,IAAM,WAAW,GAAG,YAAY,GAAM,SAAS,UAAK,YAAc,GAAG,SAAS,CAAC;QAC/E,QAAA,kBAAM,WAAW,CAAC,SAAC;QACnB,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAEjD,KAAI,CAAC,SAAS,GAAG,SAAS,IAAI,SAAS,CAAC,YAAY,CAAC;QACrD,KAAI,CAAC,YAAY,GAAG,YAAY,IAAI,EAAE,CAAC;QACvC,KAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,EAAE,CAAC;QAC/B,KAAI,CAAC,IAAI,GAAG,WAAW,CAAC;;KAC3B;;;;;IAMM,+BAAqB,GAA5B,UAA6B,OAAe;QACxC,OAAO,IAAI,SAAS,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,EAAK,gBAAgB,CAAC,eAAe,CAAC,IAAI,UAAK,OAAS,CAAC,CAAC;KACvH;IACL,gBAAC;AAAD,CAnCA,CAA+B,KAAK;;;;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AuthError } from "./AuthError";
|
|
2
|
-
import { ScopeSet } from "../request/ScopeSet";
|
|
3
2
|
/**
|
|
4
3
|
* ClientAuthErrorMessage class containing string constants used by error codes and messages.
|
|
5
4
|
*/
|
|
@@ -104,6 +103,10 @@ export declare const ClientAuthErrorMessage: {
|
|
|
104
103
|
code: string;
|
|
105
104
|
desc: string;
|
|
106
105
|
};
|
|
106
|
+
DeviceCodeUnknownError: {
|
|
107
|
+
code: string;
|
|
108
|
+
desc: string;
|
|
109
|
+
};
|
|
107
110
|
NoAccountInSilentRequest: {
|
|
108
111
|
code: string;
|
|
109
112
|
desc: string;
|
|
@@ -164,6 +167,10 @@ export declare const ClientAuthErrorMessage: {
|
|
|
164
167
|
code: string;
|
|
165
168
|
desc: string;
|
|
166
169
|
};
|
|
170
|
+
noAzureRegionDetected: {
|
|
171
|
+
code: string;
|
|
172
|
+
desc: string;
|
|
173
|
+
};
|
|
167
174
|
accessTokenEntityNullError: {
|
|
168
175
|
code: string;
|
|
169
176
|
desc: string;
|
|
@@ -273,7 +280,7 @@ export declare class ClientAuthError extends AuthError {
|
|
|
273
280
|
* Throws error if ScopeSet is null or undefined.
|
|
274
281
|
* @param givenScopeSet
|
|
275
282
|
*/
|
|
276
|
-
static createEmptyInputScopeSetError(
|
|
283
|
+
static createEmptyInputScopeSetError(): ClientAuthError;
|
|
277
284
|
/**
|
|
278
285
|
* Throws error if user sets CancellationToken.cancel = true during polling of token endpoint during device code flow
|
|
279
286
|
*/
|
|
@@ -282,6 +289,10 @@ export declare class ClientAuthError extends AuthError {
|
|
|
282
289
|
* Throws error if device code is expired
|
|
283
290
|
*/
|
|
284
291
|
static createDeviceCodeExpiredError(): ClientAuthError;
|
|
292
|
+
/**
|
|
293
|
+
* Throws error if device code is expired
|
|
294
|
+
*/
|
|
295
|
+
static createDeviceCodeUnknownError(): ClientAuthError;
|
|
285
296
|
/**
|
|
286
297
|
* Throws error when silent requests are made without an account object
|
|
287
298
|
*/
|
|
@@ -340,9 +351,5 @@ export declare class ClientAuthError extends AuthError {
|
|
|
340
351
|
* Throws error when the authorization code is missing from the server response
|
|
341
352
|
*/
|
|
342
353
|
static createNoAuthCodeInServerResponseError(): ClientAuthError;
|
|
343
|
-
/**
|
|
344
|
-
* Throws error when access token entity is null when handling a response.
|
|
345
|
-
*/
|
|
346
|
-
static createAccessTokenEntityNullError(): ClientAuthError;
|
|
347
354
|
}
|
|
348
355
|
//# sourceMappingURL=ClientAuthError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientAuthError.d.ts","sourceRoot":"","sources":["../../src/error/ClientAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ClientAuthError.d.ts","sourceRoot":"","sources":["../../src/error/ClientAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8KlC,CAAC;AAEF;;GAEG;AACH,qBAAa,eAAgB,SAAQ,SAAS;gBAE9B,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAOpD;;;OAGG;IACH,MAAM,CAAC,6BAA6B,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe;IAK1E;;;OAGG;IACH,MAAM,CAAC,0BAA0B,IAAI,eAAe;IAKpD;;;OAGG;IACH,MAAM,CAAC,uBAAuB,CAAC,qBAAqB,EAAE,MAAM,GAAG,eAAe;IAK9E;;;OAGG;IACH,MAAM,CAAC,2BAA2B,CAAC,qBAAqB,EAAE,MAAM,GAAI,eAAe;IAKnF;;OAEG;IACH,MAAM,CAAC,sCAAsC,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe;IAKjF;;OAEG;IACH,MAAM,CAAC,kBAAk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