@azure/msal-common 16.0.0-alpha.0 → 16.0.0-beta.0
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/dist/account/AccountInfo.d.ts +3 -0
- package/dist/account/AccountInfo.d.ts.map +1 -1
- package/dist/account/AccountInfo.mjs +1 -1
- package/dist/account/AccountInfo.mjs.map +1 -1
- package/dist/account/AuthToken.d.ts +6 -0
- package/dist/account/AuthToken.d.ts.map +1 -1
- package/dist/account/AuthToken.mjs +21 -2
- package/dist/account/AuthToken.mjs.map +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/CcsCredential.mjs.map +1 -1
- package/dist/account/ClientInfo.d.ts +5 -1
- package/dist/account/ClientInfo.d.ts.map +1 -1
- package/dist/account/ClientInfo.mjs +1 -1
- package/dist/account/ClientInfo.mjs.map +1 -1
- package/dist/account/TokenClaims.d.ts +4 -0
- package/dist/account/TokenClaims.d.ts.map +1 -1
- package/dist/account/TokenClaims.mjs +1 -1
- package/dist/account/TokenClaims.mjs.map +1 -1
- package/dist/authority/Authority.mjs +1 -1
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +1 -1
- package/dist/authority/AuthorityFactory.mjs.map +1 -1
- package/dist/authority/AuthorityMetadata.d.ts.map +1 -1
- package/dist/authority/AuthorityMetadata.mjs +27 -24
- package/dist/authority/AuthorityMetadata.mjs.map +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -1
- package/dist/authority/AuthorityOptions.mjs.map +1 -1
- package/dist/authority/AuthorityType.mjs +1 -1
- package/dist/authority/AuthorityType.mjs.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs.map +1 -1
- package/dist/authority/RegionDiscovery.mjs +1 -1
- package/dist/authority/RegionDiscovery.mjs.map +1 -1
- package/dist/cache/CacheManager.d.ts +5 -5
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +8 -8
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts +2 -1
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/interface/ICacheManager.d.ts +5 -5
- package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs.map +1 -1
- package/dist/cache/utils/AccountEntityUtils.d.ts +0 -7
- package/dist/cache/utils/AccountEntityUtils.d.ts.map +1 -1
- package/dist/cache/utils/AccountEntityUtils.mjs +9 -29
- package/dist/cache/utils/AccountEntityUtils.mjs.map +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +1 -1
- package/dist/cache/utils/CacheHelpers.mjs.map +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts +22 -3
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +51 -19
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts +16 -3
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +31 -12
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts +16 -3
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +21 -4
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.mjs +1 -1
- package/dist/config/ClientConfiguration.mjs.map +1 -1
- package/dist/constants/AADServerParamKeys.mjs +1 -1
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/JoseHeader.mjs.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +1 -1
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/error/AuthError.d.ts +5 -0
- package/dist/error/AuthError.d.ts.map +1 -1
- package/dist/error/AuthError.mjs +1 -1
- package/dist/error/AuthError.mjs.map +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/CacheError.mjs +1 -1
- package/dist/error/CacheError.mjs.map +1 -1
- package/dist/error/CacheErrorCodes.mjs +1 -1
- package/dist/error/ClientAuthError.mjs +1 -1
- package/dist/error/ClientAuthError.mjs.map +1 -1
- package/dist/error/ClientAuthErrorCodes.d.ts +1 -0
- package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +4 -3
- package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +1 -1
- package/dist/error/ClientConfigurationError.mjs.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.d.ts +1 -0
- package/dist/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +4 -3
- package/dist/error/ClientConfigurationErrorCodes.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs.map +1 -1
- package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist/error/NetworkError.mjs +1 -1
- package/dist/error/NetworkError.mjs.map +1 -1
- package/dist/error/PlatformBrokerError.d.ts +16 -0
- package/dist/error/PlatformBrokerError.d.ts.map +1 -0
- package/dist/error/PlatformBrokerError.mjs +49 -0
- package/dist/error/PlatformBrokerError.mjs.map +1 -0
- package/dist/error/ServerError.mjs +1 -1
- package/dist/error/ServerError.mjs.map +1 -1
- package/dist/exports-common.d.ts +4 -2
- package/dist/exports-common.d.ts.map +1 -1
- package/dist/exports-node-only.d.ts +1 -0
- package/dist/exports-node-only.d.ts.map +1 -1
- package/dist/index-node.mjs +7 -4
- package/dist/index-node.mjs.map +1 -1
- package/dist/index.mjs +7 -4
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.d.ts +24 -0
- package/dist/logger/Logger.d.ts.map +1 -1
- package/dist/logger/Logger.mjs +92 -4
- package/dist/logger/Logger.mjs.map +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/INetworkModule.mjs.map +1 -1
- package/dist/network/RequestThumbprint.mjs +2 -2
- package/dist/network/RequestThumbprint.mjs.map +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/network/ThrottlingUtils.mjs.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.mjs +1 -1
- package/dist/protocol/Authorize.mjs.map +1 -1
- package/dist/protocol/Token.d.ts +40 -0
- package/dist/protocol/Token.d.ts.map +1 -0
- package/dist/protocol/Token.mjs +129 -0
- package/dist/protocol/Token.mjs.map +1 -0
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
- package/dist/request/BaseAuthRequest.d.ts +7 -5
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationCodeRequest.d.ts +2 -1
- package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationUrlRequest.d.ts +2 -4
- package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts +2 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/CommonSilentFlowRequest.d.ts +2 -1
- package/dist/request/CommonSilentFlowRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts +3 -3
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +6 -6
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/request/ScopeSet.mjs.map +1 -1
- package/dist/response/ResponseHandler.d.ts +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +5 -5
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/telemetry/performance/IPerformanceClient.d.ts +2 -1
- package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts +4 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +30 -16
- package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +3 -0
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvents.d.ts +1 -0
- package/dist/telemetry/performance/PerformanceEvents.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvents.mjs +3 -2
- package/dist/telemetry/performance/PerformanceEvents.mjs.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/url/UrlString.mjs +1 -1
- package/dist/url/UrlString.mjs.map +1 -1
- package/dist/utils/ClientAssertionUtils.mjs +1 -1
- package/dist/utils/ClientAssertionUtils.mjs.map +1 -1
- package/dist/utils/Constants.d.ts +5 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +6 -2
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +1 -1
- package/dist/utils/FunctionWrappers.mjs.map +1 -1
- package/dist/utils/ProtocolUtils.d.ts +14 -35
- package/dist/utils/ProtocolUtils.d.ts.map +1 -1
- package/dist/utils/ProtocolUtils.mjs +56 -60
- package/dist/utils/ProtocolUtils.mjs.map +1 -1
- package/dist/utils/StateTypes.d.ts +15 -0
- package/dist/utils/StateTypes.d.ts.map +1 -0
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/StringUtils.mjs.map +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs.map +1 -1
- package/dist/utils/UrlUtils.mjs +1 -1
- package/dist/utils/UrlUtils.mjs.map +1 -1
- package/lib/index-browser.cjs +31 -17
- package/lib/index-browser.cjs.map +1 -1
- package/lib/{index-node-FrCFfFuh.js → index-node-B7mR4APO.js} +2427 -2237
- package/lib/index-node-B7mR4APO.js.map +1 -0
- package/lib/index-node.cjs +5 -3
- package/lib/index-node.cjs.map +1 -1
- package/lib/index.cjs +5 -3
- package/lib/index.cjs.map +1 -1
- package/lib/types/account/AccountInfo.d.ts +3 -0
- package/lib/types/account/AccountInfo.d.ts.map +1 -1
- package/lib/types/account/AuthToken.d.ts +6 -0
- package/lib/types/account/AuthToken.d.ts.map +1 -1
- package/lib/types/account/ClientInfo.d.ts +5 -1
- package/lib/types/account/ClientInfo.d.ts.map +1 -1
- package/lib/types/account/TokenClaims.d.ts +4 -0
- package/lib/types/account/TokenClaims.d.ts.map +1 -1
- package/lib/types/authority/AuthorityMetadata.d.ts.map +1 -1
- package/lib/types/cache/CacheManager.d.ts +5 -5
- package/lib/types/cache/CacheManager.d.ts.map +1 -1
- package/lib/types/cache/entities/AccountEntity.d.ts +2 -1
- package/lib/types/cache/entities/AccountEntity.d.ts.map +1 -1
- package/lib/types/cache/interface/ICacheManager.d.ts +5 -5
- package/lib/types/cache/interface/ICacheManager.d.ts.map +1 -1
- package/lib/types/cache/utils/AccountEntityUtils.d.ts +0 -7
- package/lib/types/cache/utils/AccountEntityUtils.d.ts.map +1 -1
- package/lib/types/client/AuthorizationCodeClient.d.ts +22 -3
- package/lib/types/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/lib/types/client/RefreshTokenClient.d.ts +16 -3
- package/lib/types/client/RefreshTokenClient.d.ts.map +1 -1
- package/lib/types/client/SilentFlowClient.d.ts +16 -3
- package/lib/types/client/SilentFlowClient.d.ts.map +1 -1
- package/lib/types/error/AuthError.d.ts +5 -0
- package/lib/types/error/AuthError.d.ts.map +1 -1
- package/lib/types/error/ClientAuthErrorCodes.d.ts +1 -0
- package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -1
- package/lib/types/error/ClientConfigurationErrorCodes.d.ts +1 -0
- package/lib/types/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
- package/lib/types/error/PlatformBrokerError.d.ts +16 -0
- package/lib/types/error/PlatformBrokerError.d.ts.map +1 -0
- package/lib/types/exports-common.d.ts +4 -2
- package/lib/types/exports-common.d.ts.map +1 -1
- package/lib/types/exports-node-only.d.ts +1 -0
- package/lib/types/exports-node-only.d.ts.map +1 -1
- package/lib/types/logger/Logger.d.ts +24 -0
- package/lib/types/logger/Logger.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/packageMetadata.d.ts.map +1 -1
- package/lib/types/protocol/Token.d.ts +40 -0
- package/lib/types/protocol/Token.d.ts.map +1 -0
- package/lib/types/request/BaseAuthRequest.d.ts +7 -5
- package/lib/types/request/BaseAuthRequest.d.ts.map +1 -1
- package/lib/types/request/CommonAuthorizationCodeRequest.d.ts +2 -1
- package/lib/types/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
- package/lib/types/request/CommonAuthorizationUrlRequest.d.ts +2 -4
- package/lib/types/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
- package/lib/types/request/CommonRefreshTokenRequest.d.ts +2 -1
- package/lib/types/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/lib/types/request/CommonSilentFlowRequest.d.ts +2 -1
- package/lib/types/request/CommonSilentFlowRequest.d.ts.map +1 -1
- package/lib/types/request/RequestParameterBuilder.d.ts +3 -3
- package/lib/types/request/RequestParameterBuilder.d.ts.map +1 -1
- package/lib/types/response/ResponseHandler.d.ts +1 -1
- package/lib/types/response/ResponseHandler.d.ts.map +1 -1
- package/lib/types/telemetry/performance/IPerformanceClient.d.ts +2 -1
- package/lib/types/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
- package/lib/types/telemetry/performance/PerformanceClient.d.ts +4 -1
- package/lib/types/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/lib/types/telemetry/performance/PerformanceEvent.d.ts +3 -0
- package/lib/types/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/lib/types/telemetry/performance/PerformanceEvents.d.ts +1 -0
- package/lib/types/telemetry/performance/PerformanceEvents.d.ts.map +1 -1
- package/lib/types/utils/Constants.d.ts +5 -0
- package/lib/types/utils/Constants.d.ts.map +1 -1
- package/lib/types/utils/ProtocolUtils.d.ts +14 -35
- package/lib/types/utils/ProtocolUtils.d.ts.map +1 -1
- package/lib/types/utils/StateTypes.d.ts +15 -0
- package/lib/types/utils/StateTypes.d.ts.map +1 -0
- package/package.json +122 -120
- package/src/account/AccountInfo.ts +5 -0
- package/src/account/AuthToken.ts +22 -0
- package/src/account/ClientInfo.ts +5 -1
- package/src/account/TokenClaims.ts +4 -0
- package/src/authority/AuthorityMetadata.ts +33 -35
- package/src/cache/CacheManager.ts +19 -10
- package/src/cache/entities/AccountEntity.ts +2 -1
- package/src/cache/interface/ICacheManager.ts +12 -4
- package/src/cache/utils/AccountEntityUtils.ts +8 -37
- package/src/client/AuthorizationCodeClient.ts +128 -19
- package/src/client/RefreshTokenClient.ts +88 -13
- package/src/client/SilentFlowClient.ts +63 -5
- package/src/error/AuthError.ts +6 -0
- package/src/error/ClientAuthErrorCodes.ts +1 -0
- package/src/error/ClientConfigurationErrorCodes.ts +1 -0
- package/src/error/PlatformBrokerError.ts +67 -0
- package/src/exports-common.ts +5 -6
- package/src/exports-node-only.ts +4 -0
- package/src/logger/Logger.ts +150 -2
- package/src/network/RequestThumbprint.ts +1 -1
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Token.ts +230 -0
- package/src/request/BaseAuthRequest.ts +7 -5
- package/src/request/CommonAuthorizationCodeRequest.ts +2 -1
- package/src/request/CommonAuthorizationUrlRequest.ts +2 -4
- package/src/request/CommonRefreshTokenRequest.ts +2 -1
- package/src/request/CommonSilentFlowRequest.ts +2 -1
- package/src/request/RequestParameterBuilder.ts +5 -5
- package/src/response/ResponseHandler.ts +9 -3
- package/src/telemetry/performance/IPerformanceClient.ts +3 -1
- package/src/telemetry/performance/PerformanceClient.ts +39 -45
- package/src/telemetry/performance/PerformanceEvent.ts +7 -0
- package/src/telemetry/performance/PerformanceEvents.ts +1 -0
- package/src/utils/Constants.ts +6 -0
- package/src/utils/ProtocolUtils.ts +66 -92
- package/src/utils/StateTypes.ts +20 -0
- package/dist/client/BaseClient.d.ts +0 -59
- package/dist/client/BaseClient.d.ts.map +0 -1
- package/dist/client/BaseClient.mjs +0 -162
- package/dist/client/BaseClient.mjs.map +0 -1
- package/dist/index-browser.mjs +0 -75
- package/dist/index-browser.mjs.map +0 -1
- package/lib/index-node-FrCFfFuh.js.map +0 -1
- package/lib/types/client/BaseClient.d.ts +0 -59
- package/lib/types/client/BaseClient.d.ts.map +0 -1
- package/src/client/BaseClient.ts +0 -308
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { BaseClient } from "./BaseClient.js";
|
|
7
6
|
import { CommonAuthorizationCodeRequest } from "../request/CommonAuthorizationCodeRequest.js";
|
|
8
7
|
import { Authority } from "../authority/Authority.js";
|
|
9
8
|
import * as RequestParameterBuilder from "../request/RequestParameterBuilder.js";
|
|
@@ -11,7 +10,9 @@ import * as UrlUtils from "../utils/UrlUtils.js";
|
|
|
11
10
|
import * as Constants from "../utils/Constants.js";
|
|
12
11
|
import * as AADServerParamKeys from "../constants/AADServerParamKeys.js";
|
|
13
12
|
import {
|
|
13
|
+
buildClientConfiguration,
|
|
14
14
|
ClientConfiguration,
|
|
15
|
+
CommonClientConfiguration,
|
|
15
16
|
isOidcProtocolMode,
|
|
16
17
|
} from "../config/ClientConfiguration.js";
|
|
17
18
|
import { ServerAuthorizationTokenResponse } from "../response/ServerAuthorizationTokenResponse.js";
|
|
@@ -43,21 +44,79 @@ import { invokeAsync } from "../utils/FunctionWrappers.js";
|
|
|
43
44
|
import { ClientAssertion } from "../account/ClientCredentials.js";
|
|
44
45
|
import { getClientAssertion } from "../utils/ClientAssertionUtils.js";
|
|
45
46
|
import { getRequestThumbprint } from "../network/RequestThumbprint.js";
|
|
47
|
+
import {
|
|
48
|
+
createTokenQueryParameters,
|
|
49
|
+
createTokenRequestHeaders,
|
|
50
|
+
executePostToTokenEndpoint,
|
|
51
|
+
} from "../protocol/Token.js";
|
|
52
|
+
import { createDiscoveredInstance } from "../authority/AuthorityFactory.js";
|
|
53
|
+
import { ServerTelemetryManager } from "../telemetry/server/ServerTelemetryManager.js";
|
|
54
|
+
import { Logger } from "../logger/Logger.js";
|
|
55
|
+
import { ICrypto } from "../crypto/ICrypto.js";
|
|
56
|
+
import { CacheManager } from "../cache/CacheManager.js";
|
|
57
|
+
import { INetworkModule } from "../network/INetworkModule.js";
|
|
58
|
+
import { version, name } from "../packageMetadata.js";
|
|
46
59
|
|
|
47
60
|
/**
|
|
48
61
|
* Oauth2.0 Authorization Code client
|
|
49
62
|
* @internal
|
|
50
63
|
*/
|
|
51
|
-
export class AuthorizationCodeClient
|
|
64
|
+
export class AuthorizationCodeClient {
|
|
52
65
|
// Flag to indicate if client is for hybrid spa auth code redemption
|
|
53
66
|
protected includeRedirectUri: boolean = true;
|
|
54
67
|
private oidcDefaultScopes;
|
|
55
68
|
|
|
69
|
+
// Logger object
|
|
70
|
+
public logger: Logger;
|
|
71
|
+
|
|
72
|
+
// Application config
|
|
73
|
+
protected config: CommonClientConfiguration;
|
|
74
|
+
|
|
75
|
+
// Crypto Interface
|
|
76
|
+
protected cryptoUtils: ICrypto;
|
|
77
|
+
|
|
78
|
+
// Storage Interface
|
|
79
|
+
protected cacheManager: CacheManager;
|
|
80
|
+
|
|
81
|
+
// Network Interface
|
|
82
|
+
protected networkClient: INetworkModule;
|
|
83
|
+
|
|
84
|
+
// Server Telemetry Manager
|
|
85
|
+
protected serverTelemetryManager: ServerTelemetryManager | null;
|
|
86
|
+
|
|
87
|
+
// Default authority object
|
|
88
|
+
public authority: Authority;
|
|
89
|
+
|
|
90
|
+
// Performance telemetry client
|
|
91
|
+
protected performanceClient: IPerformanceClient;
|
|
92
|
+
|
|
56
93
|
constructor(
|
|
57
94
|
configuration: ClientConfiguration,
|
|
58
95
|
performanceClient: IPerformanceClient
|
|
59
96
|
) {
|
|
60
|
-
|
|
97
|
+
// Set the configuration
|
|
98
|
+
this.config = buildClientConfiguration(configuration);
|
|
99
|
+
|
|
100
|
+
// Initialize the logger
|
|
101
|
+
this.logger = new Logger(this.config.loggerOptions, name, version);
|
|
102
|
+
|
|
103
|
+
// Initialize crypto
|
|
104
|
+
this.cryptoUtils = this.config.cryptoInterface;
|
|
105
|
+
|
|
106
|
+
// Initialize storage interface
|
|
107
|
+
this.cacheManager = this.config.storageInterface;
|
|
108
|
+
|
|
109
|
+
// Set the network interface
|
|
110
|
+
this.networkClient = this.config.networkInterface;
|
|
111
|
+
|
|
112
|
+
// Set TelemetryManager
|
|
113
|
+
this.serverTelemetryManager = this.config.serverTelemetryManager;
|
|
114
|
+
|
|
115
|
+
// set Authority
|
|
116
|
+
this.authority = this.config.authOptions.authority;
|
|
117
|
+
|
|
118
|
+
// set performance telemetry client
|
|
119
|
+
this.performanceClient = performanceClient;
|
|
61
120
|
this.oidcDefaultScopes =
|
|
62
121
|
this.config.authOptions.authority.options.OIDCOptions?.defaultScopes;
|
|
63
122
|
}
|
|
@@ -77,6 +136,17 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
77
136
|
);
|
|
78
137
|
}
|
|
79
138
|
|
|
139
|
+
// Check for new cloud instance
|
|
140
|
+
if (authCodePayload && authCodePayload.cloud_instance_host_name) {
|
|
141
|
+
await invokeAsync(
|
|
142
|
+
this.updateTokenEndpointAuthority.bind(this),
|
|
143
|
+
PerformanceEvents.UpdateTokenEndpointAuthority,
|
|
144
|
+
this.logger,
|
|
145
|
+
this.performanceClient,
|
|
146
|
+
request.correlationId
|
|
147
|
+
)(authCodePayload.cloud_instance_host_name, request.correlationId);
|
|
148
|
+
}
|
|
149
|
+
|
|
80
150
|
const reqTimestamp = TimeUtils.nowSeconds();
|
|
81
151
|
const response = await invokeAsync(
|
|
82
152
|
this.executeTokenRequest.bind(this),
|
|
@@ -84,7 +154,7 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
84
154
|
this.logger,
|
|
85
155
|
this.performanceClient,
|
|
86
156
|
request.correlationId
|
|
87
|
-
)(this.authority, request);
|
|
157
|
+
)(this.authority, request, this.serverTelemetryManager);
|
|
88
158
|
|
|
89
159
|
// Retrieve requestId from response headers
|
|
90
160
|
const requestId =
|
|
@@ -153,9 +223,15 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
153
223
|
*/
|
|
154
224
|
private async executeTokenRequest(
|
|
155
225
|
authority: Authority,
|
|
156
|
-
request: CommonAuthorizationCodeRequest
|
|
226
|
+
request: CommonAuthorizationCodeRequest,
|
|
227
|
+
serverTelemetryManager: ServerTelemetryManager | null
|
|
157
228
|
): Promise<NetworkResponse<ServerAuthorizationTokenResponse>> {
|
|
158
|
-
const queryParametersString =
|
|
229
|
+
const queryParametersString = createTokenQueryParameters(
|
|
230
|
+
request,
|
|
231
|
+
this.config.authOptions.clientId,
|
|
232
|
+
this.config.authOptions.redirectUri,
|
|
233
|
+
this.performanceClient
|
|
234
|
+
);
|
|
159
235
|
const endpoint = UrlString.appendQueryString(
|
|
160
236
|
authority.tokenEndpoint,
|
|
161
237
|
queryParametersString
|
|
@@ -187,7 +263,9 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
187
263
|
);
|
|
188
264
|
}
|
|
189
265
|
}
|
|
190
|
-
const headers: Record<string, string> =
|
|
266
|
+
const headers: Record<string, string> = createTokenRequestHeaders(
|
|
267
|
+
this.logger,
|
|
268
|
+
this.config.systemOptions.preventCorsPreflight,
|
|
191
269
|
ccsCredential || request.ccsCredential
|
|
192
270
|
);
|
|
193
271
|
|
|
@@ -197,12 +275,23 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
197
275
|
);
|
|
198
276
|
|
|
199
277
|
return invokeAsync(
|
|
200
|
-
|
|
278
|
+
executePostToTokenEndpoint,
|
|
201
279
|
PerformanceEvents.AuthorizationCodeClientExecutePostToTokenEndpoint,
|
|
202
280
|
this.logger,
|
|
203
281
|
this.performanceClient,
|
|
204
282
|
request.correlationId
|
|
205
|
-
)(
|
|
283
|
+
)(
|
|
284
|
+
endpoint,
|
|
285
|
+
requestBody,
|
|
286
|
+
headers,
|
|
287
|
+
thumbprint,
|
|
288
|
+
request.correlationId,
|
|
289
|
+
this.cacheManager,
|
|
290
|
+
this.networkClient,
|
|
291
|
+
this.logger,
|
|
292
|
+
this.performanceClient,
|
|
293
|
+
serverTelemetryManager
|
|
294
|
+
);
|
|
206
295
|
}
|
|
207
296
|
|
|
208
297
|
/**
|
|
@@ -217,7 +306,7 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
217
306
|
RequestParameterBuilder.addClientId(
|
|
218
307
|
parameters,
|
|
219
308
|
request.embeddedClientId ||
|
|
220
|
-
request.
|
|
309
|
+
request.extraParameters?.[AADServerParamKeys.CLIENT_ID] ||
|
|
221
310
|
this.config.authOptions.clientId
|
|
222
311
|
);
|
|
223
312
|
|
|
@@ -413,22 +502,20 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
413
502
|
);
|
|
414
503
|
}
|
|
415
504
|
|
|
416
|
-
if (request.
|
|
417
|
-
RequestParameterBuilder.
|
|
505
|
+
if (request.extraParameters) {
|
|
506
|
+
RequestParameterBuilder.addExtraParameters(
|
|
418
507
|
parameters,
|
|
419
|
-
request.
|
|
508
|
+
request.extraParameters
|
|
420
509
|
);
|
|
421
510
|
}
|
|
422
511
|
|
|
423
512
|
// Add hybrid spa parameters if not already provided
|
|
424
513
|
if (
|
|
425
514
|
request.enableSpaAuthorizationCode &&
|
|
426
|
-
(!request.
|
|
427
|
-
!request.
|
|
428
|
-
AADServerParamKeys.RETURN_SPA_CODE
|
|
429
|
-
])
|
|
515
|
+
(!request.extraParameters ||
|
|
516
|
+
!request.extraParameters[AADServerParamKeys.RETURN_SPA_CODE])
|
|
430
517
|
) {
|
|
431
|
-
RequestParameterBuilder.
|
|
518
|
+
RequestParameterBuilder.addExtraParameters(parameters, {
|
|
432
519
|
[AADServerParamKeys.RETURN_SPA_CODE]: "1",
|
|
433
520
|
});
|
|
434
521
|
}
|
|
@@ -483,7 +570,7 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
483
570
|
}
|
|
484
571
|
|
|
485
572
|
if (request.extraQueryParameters) {
|
|
486
|
-
RequestParameterBuilder.
|
|
573
|
+
RequestParameterBuilder.addExtraParameters(
|
|
487
574
|
parameters,
|
|
488
575
|
request.extraQueryParameters
|
|
489
576
|
);
|
|
@@ -495,4 +582,26 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
495
582
|
|
|
496
583
|
return UrlUtils.mapToQueryString(parameters);
|
|
497
584
|
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Updates the authority to the cloud instance provided in the authorization response
|
|
588
|
+
* @param cloudInstanceHostName - cloud instance host name from authorization code payload
|
|
589
|
+
* @param correlationId - request correlation id
|
|
590
|
+
*/
|
|
591
|
+
private async updateTokenEndpointAuthority(
|
|
592
|
+
cloudInstanceHostName: string,
|
|
593
|
+
correlationId: string
|
|
594
|
+
): Promise<void> {
|
|
595
|
+
const cloudInstanceAuthorityUri = `https://${cloudInstanceHostName}/${this.authority.tenant}/`;
|
|
596
|
+
const cloudInstanceAuthority = await createDiscoveredInstance(
|
|
597
|
+
cloudInstanceAuthorityUri,
|
|
598
|
+
this.networkClient,
|
|
599
|
+
this.cacheManager,
|
|
600
|
+
this.authority.options,
|
|
601
|
+
this.logger,
|
|
602
|
+
correlationId,
|
|
603
|
+
this.performanceClient
|
|
604
|
+
);
|
|
605
|
+
this.authority = cloudInstanceAuthority;
|
|
606
|
+
}
|
|
498
607
|
}
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
+
buildClientConfiguration,
|
|
7
8
|
ClientConfiguration,
|
|
9
|
+
CommonClientConfiguration,
|
|
8
10
|
isOidcProtocolMode,
|
|
9
11
|
} from "../config/ClientConfiguration.js";
|
|
10
|
-
import { BaseClient } from "./BaseClient.js";
|
|
11
12
|
import { CommonRefreshTokenRequest } from "../request/CommonRefreshTokenRequest.js";
|
|
12
13
|
import { Authority } from "../authority/Authority.js";
|
|
13
14
|
import { ServerAuthorizationTokenResponse } from "../response/ServerAuthorizationTokenResponse.js";
|
|
@@ -45,6 +46,17 @@ import { invoke, invokeAsync } from "../utils/FunctionWrappers.js";
|
|
|
45
46
|
import { ClientAssertion } from "../account/ClientCredentials.js";
|
|
46
47
|
import { getClientAssertion } from "../utils/ClientAssertionUtils.js";
|
|
47
48
|
import { getRequestThumbprint } from "../network/RequestThumbprint.js";
|
|
49
|
+
import {
|
|
50
|
+
createTokenQueryParameters,
|
|
51
|
+
createTokenRequestHeaders,
|
|
52
|
+
executePostToTokenEndpoint,
|
|
53
|
+
} from "../protocol/Token.js";
|
|
54
|
+
import { ServerTelemetryManager } from "../telemetry/server/ServerTelemetryManager.js";
|
|
55
|
+
import { INetworkModule } from "../network/INetworkModule.js";
|
|
56
|
+
import { CacheManager } from "../cache/CacheManager.js";
|
|
57
|
+
import { ICrypto } from "../crypto/ICrypto.js";
|
|
58
|
+
import { Logger } from "../logger/Logger.js";
|
|
59
|
+
import { version, name } from "../packageMetadata.js";
|
|
48
60
|
|
|
49
61
|
const DEFAULT_REFRESH_TOKEN_EXPIRATION_OFFSET_SECONDS = 300; // 5 Minutes
|
|
50
62
|
|
|
@@ -52,12 +64,58 @@ const DEFAULT_REFRESH_TOKEN_EXPIRATION_OFFSET_SECONDS = 300; // 5 Minutes
|
|
|
52
64
|
* OAuth2.0 refresh token client
|
|
53
65
|
* @internal
|
|
54
66
|
*/
|
|
55
|
-
export class RefreshTokenClient
|
|
67
|
+
export class RefreshTokenClient {
|
|
68
|
+
// Logger object
|
|
69
|
+
public logger: Logger;
|
|
70
|
+
|
|
71
|
+
// Application config
|
|
72
|
+
protected config: CommonClientConfiguration;
|
|
73
|
+
|
|
74
|
+
// Crypto Interface
|
|
75
|
+
protected cryptoUtils: ICrypto;
|
|
76
|
+
|
|
77
|
+
// Storage Interface
|
|
78
|
+
protected cacheManager: CacheManager;
|
|
79
|
+
|
|
80
|
+
// Network Interface
|
|
81
|
+
protected networkClient: INetworkModule;
|
|
82
|
+
|
|
83
|
+
// Server Telemetry Manager
|
|
84
|
+
protected serverTelemetryManager: ServerTelemetryManager | null;
|
|
85
|
+
|
|
86
|
+
// Default authority object
|
|
87
|
+
public authority: Authority;
|
|
88
|
+
|
|
89
|
+
// Performance telemetry client
|
|
90
|
+
protected performanceClient: IPerformanceClient;
|
|
91
|
+
|
|
56
92
|
constructor(
|
|
57
93
|
configuration: ClientConfiguration,
|
|
58
94
|
performanceClient: IPerformanceClient
|
|
59
95
|
) {
|
|
60
|
-
|
|
96
|
+
// Set the configuration
|
|
97
|
+
this.config = buildClientConfiguration(configuration);
|
|
98
|
+
|
|
99
|
+
// Initialize the logger
|
|
100
|
+
this.logger = new Logger(this.config.loggerOptions, name, version);
|
|
101
|
+
|
|
102
|
+
// Initialize crypto
|
|
103
|
+
this.cryptoUtils = this.config.cryptoInterface;
|
|
104
|
+
|
|
105
|
+
// Initialize storage interface
|
|
106
|
+
this.cacheManager = this.config.storageInterface;
|
|
107
|
+
|
|
108
|
+
// Set the network interface
|
|
109
|
+
this.networkClient = this.config.networkInterface;
|
|
110
|
+
|
|
111
|
+
// Set TelemetryManager
|
|
112
|
+
this.serverTelemetryManager = this.config.serverTelemetryManager;
|
|
113
|
+
|
|
114
|
+
// set Authority
|
|
115
|
+
this.authority = this.config.authOptions.authority;
|
|
116
|
+
|
|
117
|
+
// set performance telemetry client
|
|
118
|
+
this.performanceClient = performanceClient;
|
|
61
119
|
}
|
|
62
120
|
public async acquireToken(
|
|
63
121
|
request: CommonRefreshTokenRequest
|
|
@@ -274,7 +332,12 @@ export class RefreshTokenClient extends BaseClient {
|
|
|
274
332
|
request: CommonRefreshTokenRequest,
|
|
275
333
|
authority: Authority
|
|
276
334
|
): Promise<NetworkResponse<ServerAuthorizationTokenResponse>> {
|
|
277
|
-
const queryParametersString =
|
|
335
|
+
const queryParametersString = createTokenQueryParameters(
|
|
336
|
+
request,
|
|
337
|
+
this.config.authOptions.clientId,
|
|
338
|
+
this.config.authOptions.redirectUri,
|
|
339
|
+
this.performanceClient
|
|
340
|
+
);
|
|
278
341
|
const endpoint = UrlString.appendQueryString(
|
|
279
342
|
authority.tokenEndpoint,
|
|
280
343
|
queryParametersString
|
|
@@ -287,7 +350,9 @@ export class RefreshTokenClient extends BaseClient {
|
|
|
287
350
|
this.performanceClient,
|
|
288
351
|
request.correlationId
|
|
289
352
|
)(request);
|
|
290
|
-
const headers: Record<string, string> =
|
|
353
|
+
const headers: Record<string, string> = createTokenRequestHeaders(
|
|
354
|
+
this.logger,
|
|
355
|
+
this.config.systemOptions.preventCorsPreflight,
|
|
291
356
|
request.ccsCredential
|
|
292
357
|
);
|
|
293
358
|
|
|
@@ -297,12 +362,23 @@ export class RefreshTokenClient extends BaseClient {
|
|
|
297
362
|
);
|
|
298
363
|
|
|
299
364
|
return invokeAsync(
|
|
300
|
-
|
|
365
|
+
executePostToTokenEndpoint,
|
|
301
366
|
PerformanceEvents.RefreshTokenClientExecutePostToTokenEndpoint,
|
|
302
367
|
this.logger,
|
|
303
368
|
this.performanceClient,
|
|
304
369
|
request.correlationId
|
|
305
|
-
)(
|
|
370
|
+
)(
|
|
371
|
+
endpoint,
|
|
372
|
+
requestBody,
|
|
373
|
+
headers,
|
|
374
|
+
thumbprint,
|
|
375
|
+
request.correlationId,
|
|
376
|
+
this.cacheManager,
|
|
377
|
+
this.networkClient,
|
|
378
|
+
this.logger,
|
|
379
|
+
this.performanceClient,
|
|
380
|
+
this.serverTelemetryManager
|
|
381
|
+
);
|
|
306
382
|
}
|
|
307
383
|
|
|
308
384
|
/**
|
|
@@ -317,7 +393,7 @@ export class RefreshTokenClient extends BaseClient {
|
|
|
317
393
|
RequestParameterBuilder.addClientId(
|
|
318
394
|
parameters,
|
|
319
395
|
request.embeddedClientId ||
|
|
320
|
-
request.
|
|
396
|
+
request.extraParameters?.[AADServerParamKeys.CLIENT_ID] ||
|
|
321
397
|
this.config.authOptions.clientId
|
|
322
398
|
);
|
|
323
399
|
|
|
@@ -476,11 +552,10 @@ export class RefreshTokenClient extends BaseClient {
|
|
|
476
552
|
);
|
|
477
553
|
}
|
|
478
554
|
|
|
479
|
-
if (request.
|
|
480
|
-
RequestParameterBuilder.
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
);
|
|
555
|
+
if (request.extraParameters) {
|
|
556
|
+
RequestParameterBuilder.addExtraParameters(parameters, {
|
|
557
|
+
...request.extraParameters,
|
|
558
|
+
});
|
|
484
559
|
}
|
|
485
560
|
|
|
486
561
|
RequestParameterBuilder.instrumentBrokerParams(
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
buildClientConfiguration,
|
|
8
|
+
ClientConfiguration,
|
|
9
|
+
CommonClientConfiguration,
|
|
10
|
+
} from "../config/ClientConfiguration.js";
|
|
8
11
|
import { CommonSilentFlowRequest } from "../request/CommonSilentFlowRequest.js";
|
|
9
12
|
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
|
10
13
|
import * as TimeUtils from "../utils/TimeUtils.js";
|
|
@@ -21,15 +24,70 @@ import { checkMaxAge, extractTokenClaims } from "../account/AuthToken.js";
|
|
|
21
24
|
import { TokenClaims } from "../account/TokenClaims.js";
|
|
22
25
|
import * as PerformanceEvents from "../telemetry/performance/PerformanceEvents.js";
|
|
23
26
|
import { invokeAsync } from "../utils/FunctionWrappers.js";
|
|
24
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
Authority,
|
|
29
|
+
getTenantFromAuthorityString,
|
|
30
|
+
} from "../authority/Authority.js";
|
|
31
|
+
import { Logger } from "../logger/Logger.js";
|
|
32
|
+
import { ICrypto } from "../crypto/ICrypto.js";
|
|
33
|
+
import { CacheManager } from "../cache/CacheManager.js";
|
|
34
|
+
import { INetworkModule } from "../network/INetworkModule.js";
|
|
35
|
+
import { ServerTelemetryManager } from "../telemetry/server/ServerTelemetryManager.js";
|
|
36
|
+
import { version, name } from "../packageMetadata.js";
|
|
25
37
|
|
|
26
38
|
/** @internal */
|
|
27
|
-
export class SilentFlowClient
|
|
39
|
+
export class SilentFlowClient {
|
|
40
|
+
// Logger object
|
|
41
|
+
public logger: Logger;
|
|
42
|
+
|
|
43
|
+
// Application config
|
|
44
|
+
protected config: CommonClientConfiguration;
|
|
45
|
+
|
|
46
|
+
// Crypto Interface
|
|
47
|
+
protected cryptoUtils: ICrypto;
|
|
48
|
+
|
|
49
|
+
// Storage Interface
|
|
50
|
+
protected cacheManager: CacheManager;
|
|
51
|
+
|
|
52
|
+
// Network Interface
|
|
53
|
+
protected networkClient: INetworkModule;
|
|
54
|
+
|
|
55
|
+
// Server Telemetry Manager
|
|
56
|
+
protected serverTelemetryManager: ServerTelemetryManager | null;
|
|
57
|
+
|
|
58
|
+
// Default authority object
|
|
59
|
+
public authority: Authority;
|
|
60
|
+
|
|
61
|
+
// Performance telemetry client
|
|
62
|
+
protected performanceClient: IPerformanceClient;
|
|
63
|
+
|
|
28
64
|
constructor(
|
|
29
65
|
configuration: ClientConfiguration,
|
|
30
66
|
performanceClient: IPerformanceClient
|
|
31
67
|
) {
|
|
32
|
-
|
|
68
|
+
// Set the configuration
|
|
69
|
+
this.config = buildClientConfiguration(configuration);
|
|
70
|
+
|
|
71
|
+
// Initialize the logger
|
|
72
|
+
this.logger = new Logger(this.config.loggerOptions, name, version);
|
|
73
|
+
|
|
74
|
+
// Initialize crypto
|
|
75
|
+
this.cryptoUtils = this.config.cryptoInterface;
|
|
76
|
+
|
|
77
|
+
// Initialize storage interface
|
|
78
|
+
this.cacheManager = this.config.storageInterface;
|
|
79
|
+
|
|
80
|
+
// Set the network interface
|
|
81
|
+
this.networkClient = this.config.networkInterface;
|
|
82
|
+
|
|
83
|
+
// Set TelemetryManager
|
|
84
|
+
this.serverTelemetryManager = this.config.serverTelemetryManager;
|
|
85
|
+
|
|
86
|
+
// set Authority
|
|
87
|
+
this.authority = this.config.authOptions.authority;
|
|
88
|
+
|
|
89
|
+
// set performance telemetry client
|
|
90
|
+
this.performanceClient = performanceClient;
|
|
33
91
|
}
|
|
34
92
|
|
|
35
93
|
/**
|
package/src/error/AuthError.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import * as AuthErrorCodes from "./AuthErrorCodes.js";
|
|
7
|
+
import type { PlatformBrokerError } from "./PlatformBrokerError.js";
|
|
7
8
|
export { AuthErrorCodes };
|
|
8
9
|
|
|
9
10
|
export function getDefaultErrorMessage(code: string): string {
|
|
@@ -34,6 +35,11 @@ export class AuthError extends Error {
|
|
|
34
35
|
*/
|
|
35
36
|
correlationId: string;
|
|
36
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Default PlatformBrokerError from MsalNodeRuntime when broker is enabled
|
|
40
|
+
*/
|
|
41
|
+
platformBrokerError?: PlatformBrokerError;
|
|
42
|
+
|
|
37
43
|
constructor(errorCode?: string, errorMessage?: string, suberror?: string) {
|
|
38
44
|
const message =
|
|
39
45
|
errorMessage ||
|
|
@@ -42,3 +42,4 @@ export const noNetworkConnectivity = "no_network_connectivity";
|
|
|
42
42
|
export const userCanceled = "user_canceled";
|
|
43
43
|
export const methodNotImplemented = "method_not_implemented";
|
|
44
44
|
export const nestedAppAuthBridgeDisabled = "nested_app_auth_bridge_disabled";
|
|
45
|
+
export const platformBrokerError = "platform_broker_error";
|
|
@@ -25,3 +25,4 @@ export const invalidAuthenticationHeader = "invalid_authentication_header";
|
|
|
25
25
|
export const cannotSetOIDCOptions = "cannot_set_OIDCOptions";
|
|
26
26
|
export const cannotAllowPlatformBroker = "cannot_allow_platform_broker";
|
|
27
27
|
export const authorityMismatch = "authority_mismatch";
|
|
28
|
+
export const invalidRequestMethodForEAR = "invalid_request_method_for_EAR";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { AuthError } from "./AuthError.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Converts a numeric tag from MSAL Runtime to a 5-character string representation.
|
|
10
|
+
* Tags are encoded as 30-bit values (6 bits per character) using a custom symbol space.
|
|
11
|
+
* @param tag - The numeric tag to convert
|
|
12
|
+
* @returns The string representation of the tag
|
|
13
|
+
*/
|
|
14
|
+
function tagToString(tag: number): string {
|
|
15
|
+
if (tag === 0) {
|
|
16
|
+
return "UNTAG";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const tagSymbolSpace =
|
|
20
|
+
"abcdefghijklmnopqrstuvwxyz0123456789****************************";
|
|
21
|
+
let tagBuffer = "*****";
|
|
22
|
+
|
|
23
|
+
const chars = [
|
|
24
|
+
tagSymbolSpace[(tag >> 24) & 0x3f],
|
|
25
|
+
tagSymbolSpace[(tag >> 18) & 0x3f],
|
|
26
|
+
tagSymbolSpace[(tag >> 12) & 0x3f],
|
|
27
|
+
tagSymbolSpace[(tag >> 6) & 0x3f],
|
|
28
|
+
tagSymbolSpace[(tag >> 0) & 0x3f],
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
tagBuffer = chars.join("");
|
|
32
|
+
|
|
33
|
+
return tagBuffer;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Error class for MSAL Runtime errors that preserves detailed broker information
|
|
38
|
+
*/
|
|
39
|
+
export class PlatformBrokerError extends AuthError {
|
|
40
|
+
/**
|
|
41
|
+
* Numeric error code from MSAL Runtime
|
|
42
|
+
*/
|
|
43
|
+
public statusCode: number;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Error tag from MSAL Runtime
|
|
47
|
+
*/
|
|
48
|
+
public tag: string;
|
|
49
|
+
|
|
50
|
+
constructor(
|
|
51
|
+
errorStatus: string,
|
|
52
|
+
errorContext: string,
|
|
53
|
+
errorCode: number,
|
|
54
|
+
errorTag: number
|
|
55
|
+
) {
|
|
56
|
+
const tagString = tagToString(errorTag);
|
|
57
|
+
const enhancedErrorContext = errorContext
|
|
58
|
+
? `${errorContext} (Error Code: ${errorCode}, Tag: ${tagString})`
|
|
59
|
+
: `(Error Code: ${errorCode}, Tag: ${tagString})`;
|
|
60
|
+
|
|
61
|
+
super(errorStatus, enhancedErrorContext);
|
|
62
|
+
this.name = "PlatformBrokerError";
|
|
63
|
+
this.statusCode = errorCode;
|
|
64
|
+
this.tag = tagString;
|
|
65
|
+
Object.setPrototypeOf(this, PlatformBrokerError.prototype);
|
|
66
|
+
}
|
|
67
|
+
}
|
package/src/exports-common.ts
CHANGED
|
@@ -22,7 +22,6 @@ export { AccountEntityUtils };
|
|
|
22
22
|
export { AuthorizationCodeClient } from "./client/AuthorizationCodeClient.js";
|
|
23
23
|
export { RefreshTokenClient } from "./client/RefreshTokenClient.js";
|
|
24
24
|
export { SilentFlowClient } from "./client/SilentFlowClient.js";
|
|
25
|
-
export { BaseClient } from "./client/BaseClient.js";
|
|
26
25
|
export {
|
|
27
26
|
AuthOptions,
|
|
28
27
|
SystemOptions,
|
|
@@ -108,6 +107,8 @@ export {
|
|
|
108
107
|
} from "./crypto/ICrypto.js";
|
|
109
108
|
|
|
110
109
|
export * as AuthorizeProtocol from "./protocol/Authorize.js";
|
|
110
|
+
export * as TokenProtocol from "./protocol/Token.js";
|
|
111
|
+
|
|
111
112
|
export { BaseAuthRequest } from "./request/BaseAuthRequest.js";
|
|
112
113
|
export { CommonAuthorizationUrlRequest } from "./request/CommonAuthorizationUrlRequest.js";
|
|
113
114
|
export { CommonAuthorizationCodeRequest } from "./request/CommonAuthorizationCodeRequest.js";
|
|
@@ -139,6 +140,7 @@ export {
|
|
|
139
140
|
AuthErrorCodes,
|
|
140
141
|
createAuthError,
|
|
141
142
|
} from "./error/AuthError.js";
|
|
143
|
+
export { PlatformBrokerError } from "./error/PlatformBrokerError.js";
|
|
142
144
|
export { ServerError } from "./error/ServerError.js";
|
|
143
145
|
export { NetworkError, createNetworkError } from "./error/NetworkError.js";
|
|
144
146
|
export {
|
|
@@ -160,11 +162,8 @@ export * as Constants from "./utils/Constants.js";
|
|
|
160
162
|
|
|
161
163
|
export { StringUtils } from "./utils/StringUtils.js";
|
|
162
164
|
export { StringDict } from "./utils/MsalTypes.js";
|
|
163
|
-
export {
|
|
164
|
-
|
|
165
|
-
RequestStateObject,
|
|
166
|
-
LibraryStateObject,
|
|
167
|
-
} from "./utils/ProtocolUtils.js";
|
|
165
|
+
export { RequestStateObject, LibraryStateObject } from "./utils/StateTypes.js";
|
|
166
|
+
export * as ProtocolUtils from "./utils/ProtocolUtils.js";
|
|
168
167
|
export * from "./utils/FunctionWrappers.js";
|
|
169
168
|
export { ServerTelemetryManager } from "./telemetry/server/ServerTelemetryManager.js";
|
|
170
169
|
export { ServerTelemetryRequest } from "./telemetry/server/ServerTelemetryRequest.js";
|
package/src/exports-node-only.ts
CHANGED
|
@@ -30,3 +30,7 @@ export {
|
|
|
30
30
|
export { getClientAssertion } from "./utils/ClientAssertionUtils.js";
|
|
31
31
|
export { IGuidGenerator } from "./crypto/IGuidGenerator.js";
|
|
32
32
|
export { StubPerformanceClient } from "./telemetry/performance/StubPerformanceClient.js";
|
|
33
|
+
export {
|
|
34
|
+
buildClientConfiguration,
|
|
35
|
+
CommonClientConfiguration,
|
|
36
|
+
} from "./config/ClientConfiguration.js";
|