@azure/msal-common 14.0.2 → 14.0.3
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/AuthToken.d.ts +14 -17
- package/dist/account/AuthToken.d.ts.map +1 -1
- package/dist/account/AuthToken.mjs +48 -39
- 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.map +1 -1
- package/dist/account/ClientInfo.mjs +3 -4
- package/dist/account/ClientInfo.mjs.map +1 -1
- package/dist/authority/Authority.mjs +1 -1
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +2 -3
- package/dist/authority/AuthorityFactory.mjs.map +1 -1
- package/dist/authority/AuthorityMetadata.mjs +1 -1
- 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/CloudInstanceDiscoveryErrorResponse.mjs.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs.map +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs.map +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.map +1 -1
- package/dist/cache/CacheManager.mjs +5 -5
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.mjs +4 -7
- package/dist/cache/entities/AccessTokenEntity.mjs.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +2 -4
- package/dist/cache/entities/AccountEntity.mjs.map +1 -1
- package/dist/cache/entities/AppMetadataEntity.mjs +1 -1
- package/dist/cache/entities/AppMetadataEntity.mjs.map +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.mjs +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.mjs.map +1 -1
- package/dist/cache/entities/CacheRecord.mjs +1 -1
- package/dist/cache/entities/CacheRecord.mjs.map +1 -1
- package/dist/cache/entities/CredentialEntity.mjs +1 -1
- package/dist/cache/entities/CredentialEntity.mjs.map +1 -1
- package/dist/cache/entities/IdTokenEntity.mjs +1 -1
- package/dist/cache/entities/IdTokenEntity.mjs.map +1 -1
- package/dist/cache/entities/RefreshTokenEntity.mjs +1 -1
- package/dist/cache/entities/RefreshTokenEntity.mjs.map +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.mjs +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.mjs.map +1 -1
- package/dist/cache/entities/ThrottlingEntity.mjs +1 -1
- package/dist/cache/entities/ThrottlingEntity.mjs.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs.map +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +10 -39
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.d.ts +1 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.mjs +8 -2
- package/dist/client/BaseClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +2 -11
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +7 -7
- 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/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.mjs +1 -1
- package/dist/error/AuthError.mjs.map +1 -1
- package/dist/error/ClientAuthError.mjs +1 -1
- package/dist/error/ClientAuthError.mjs.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +1 -1
- package/dist/error/ClientConfigurationError.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
- package/dist/error/JoseHeaderError.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs.map +1 -1
- package/dist/error/ServerError.mjs +1 -1
- package/dist/error/ServerError.mjs.map +1 -1
- package/dist/index.cjs +1641 -1560
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.d.ts.map +1 -1
- package/dist/logger/Logger.mjs +2 -12
- 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/NetworkManager.mjs +1 -1
- package/dist/network/NetworkManager.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.mjs +2 -2
- package/dist/packageMetadata.mjs.map +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +6 -7
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/RequestValidator.d.ts.map +1 -1
- package/dist/request/RequestValidator.mjs +4 -6
- package/dist/request/RequestValidator.mjs.map +1 -1
- package/dist/request/ScopeSet.mjs +4 -4
- package/dist/request/ScopeSet.mjs.map +1 -1
- package/dist/response/AuthenticationResult.d.ts +3 -1
- package/dist/response/AuthenticationResult.d.ts.map +1 -1
- package/dist/response/ResponseHandler.d.ts +4 -3
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +57 -39
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/response/ServerAuthorizationTokenResponse.d.ts +2 -0
- package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -1
- package/dist/telemetry/performance/IPerformanceClient.d.ts +4 -4
- package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts +2 -2
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +8 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +9 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.d.ts +3 -3
- package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +23 -3
- package/dist/telemetry/performance/StubPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +3 -4
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.mjs +10 -12
- package/dist/url/UrlString.mjs.map +1 -1
- package/dist/utils/Constants.d.ts +10 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +11 -2
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.d.ts +28 -0
- package/dist/utils/FunctionWrappers.d.ts.map +1 -0
- package/dist/utils/FunctionWrappers.mjs +90 -0
- package/dist/utils/FunctionWrappers.mjs.map +1 -0
- package/dist/utils/ProtocolUtils.d.ts.map +1 -1
- package/dist/utils/ProtocolUtils.mjs +4 -7
- package/dist/utils/ProtocolUtils.mjs.map +1 -1
- package/dist/utils/StringUtils.d.ts +0 -13
- package/dist/utils/StringUtils.d.ts.map +1 -1
- package/dist/utils/StringUtils.mjs +3 -34
- package/dist/utils/StringUtils.mjs.map +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs.map +1 -1
- package/package.json +6 -4
- package/src/account/AccountInfo.ts +44 -0
- package/src/account/AuthToken.ts +70 -0
- package/src/account/CcsCredential.ts +16 -0
- package/src/account/ClientCredentials.ts +20 -0
- package/src/account/ClientInfo.ts +64 -0
- package/src/account/TokenClaims.ts +70 -0
- package/src/authority/Authority.ts +1225 -0
- package/src/authority/AuthorityFactory.ts +106 -0
- package/src/authority/AuthorityMetadata.ts +953 -0
- package/src/authority/AuthorityOptions.ts +40 -0
- package/src/authority/AuthorityType.ts +15 -0
- package/src/authority/AzureRegion.ts +7 -0
- package/src/authority/AzureRegionConfiguration.ts +16 -0
- package/src/authority/CloudDiscoveryMetadata.ts +10 -0
- package/src/authority/CloudInstanceDiscoveryErrorResponse.ts +26 -0
- package/src/authority/CloudInstanceDiscoveryResponse.ts +21 -0
- package/src/authority/ImdsOptions.ts +10 -0
- package/src/authority/OIDCOptions.ts +14 -0
- package/src/authority/OpenIdConfigResponse.ts +24 -0
- package/src/authority/ProtocolMode.ts +13 -0
- package/src/authority/RegionDiscovery.ts +193 -0
- package/src/authority/RegionDiscoveryMetadata.ts +15 -0
- package/src/broker/nativeBroker/INativeBrokerPlugin.ts +29 -0
- package/src/cache/CacheManager.ts +1619 -0
- package/src/cache/entities/AccessTokenEntity.ts +162 -0
- package/src/cache/entities/AccountEntity.ts +309 -0
- package/src/cache/entities/AppMetadataEntity.ts +91 -0
- package/src/cache/entities/AuthorityMetadataEntity.ts +112 -0
- package/src/cache/entities/CacheRecord.ts +33 -0
- package/src/cache/entities/CredentialEntity.ts +215 -0
- package/src/cache/entities/IdTokenEntity.ts +74 -0
- package/src/cache/entities/RefreshTokenEntity.ts +78 -0
- package/src/cache/entities/ServerTelemetryEntity.ts +38 -0
- package/src/cache/entities/ThrottlingEntity.ts +36 -0
- package/src/cache/interface/ICacheManager.ts +218 -0
- package/src/cache/interface/ICachePlugin.ts +11 -0
- package/src/cache/interface/ISerializableTokenCache.ts +9 -0
- package/src/cache/persistence/TokenCacheContext.ts +39 -0
- package/src/cache/utils/CacheTypes.ts +93 -0
- package/src/client/AuthorizationCodeClient.ts +714 -0
- package/src/client/BaseClient.ts +205 -0
- package/src/client/RefreshTokenClient.ts +442 -0
- package/src/client/SilentFlowClient.ts +186 -0
- package/src/config/AppTokenProvider.ts +47 -0
- package/src/config/ClientConfiguration.ts +287 -0
- package/src/crypto/ICrypto.ts +127 -0
- package/src/crypto/IGuidGenerator.ts +9 -0
- package/src/crypto/JoseHeader.ts +55 -0
- package/src/crypto/PopTokenGenerator.ts +155 -0
- package/src/crypto/SignedHttpRequest.ts +16 -0
- package/src/error/AuthError.ts +85 -0
- package/src/error/ClientAuthError.ts +738 -0
- package/src/error/ClientConfigurationError.ts +396 -0
- package/src/error/InteractionRequiredAuthError.ts +134 -0
- package/src/error/JoseHeaderError.ts +52 -0
- package/src/error/ServerError.ts +18 -0
- package/src/index.ts +215 -0
- package/src/logger/Logger.ts +272 -0
- package/src/network/INetworkModule.ts +57 -0
- package/src/network/NetworkManager.ts +76 -0
- package/src/network/RequestThumbprint.ts +22 -0
- package/src/network/ThrottlingUtils.ts +156 -0
- package/src/packageMetadata.ts +3 -0
- package/src/request/AuthenticationHeaderParser.ts +89 -0
- package/src/request/BaseAuthRequest.ts +46 -0
- package/src/request/CommonAuthorizationCodeRequest.ts +33 -0
- package/src/request/CommonAuthorizationUrlRequest.ts +56 -0
- package/src/request/CommonClientCredentialRequest.ts +23 -0
- package/src/request/CommonDeviceCodeRequest.ts +31 -0
- package/src/request/CommonEndSessionRequest.ts +27 -0
- package/src/request/CommonOnBehalfOfRequest.ts +19 -0
- package/src/request/CommonRefreshTokenRequest.ts +25 -0
- package/src/request/CommonSilentFlowRequest.ts +24 -0
- package/src/request/CommonUsernamePasswordRequest.ts +23 -0
- package/src/request/NativeRequest.ts +25 -0
- package/src/request/NativeSignOutRequest.ts +10 -0
- package/src/request/RequestParameterBuilder.ts +606 -0
- package/src/request/RequestValidator.ts +103 -0
- package/src/request/ScopeSet.ts +230 -0
- package/src/request/StoreInCache.ts +16 -0
- package/src/response/AuthenticationResult.ts +47 -0
- package/src/response/AuthorizationCodePayload.ts +18 -0
- package/src/response/DeviceCodeResponse.ts +31 -0
- package/src/response/ExternalTokenResponse.ts +24 -0
- package/src/response/IMDSBadResponse.ts +9 -0
- package/src/response/ResponseHandler.ts +614 -0
- package/src/response/ServerAuthorizationCodeResponse.ts +33 -0
- package/src/response/ServerAuthorizationTokenResponse.ts +54 -0
- package/src/telemetry/performance/IPerformanceClient.ts +71 -0
- package/src/telemetry/performance/IPerformanceMeasurement.ts +10 -0
- package/src/telemetry/performance/PerformanceClient.ts +635 -0
- package/src/telemetry/performance/PerformanceEvent.ts +542 -0
- package/src/telemetry/performance/StubPerformanceClient.ts +101 -0
- package/src/telemetry/server/ServerTelemetryManager.ts +274 -0
- package/src/telemetry/server/ServerTelemetryRequest.ts +13 -0
- package/src/url/IUri.ts +17 -0
- package/src/url/UrlString.ts +363 -0
- package/src/utils/Constants.ts +436 -0
- package/src/utils/FunctionWrappers.ts +105 -0
- package/src/utils/MsalTypes.ts +9 -0
- package/src/utils/ProtocolUtils.ts +124 -0
- package/src/utils/StringUtils.ts +106 -0
- package/src/utils/TimeUtils.ts +51 -0
- package/dist/account/DecodedAuthToken.d.ts +0 -9
- package/dist/account/DecodedAuthToken.d.ts.map +0 -1
package/src/index.ts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
* @module @azure/msal-common
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export { AuthorizationCodeClient } from "./client/AuthorizationCodeClient";
|
|
12
|
+
export { RefreshTokenClient } from "./client/RefreshTokenClient";
|
|
13
|
+
export { SilentFlowClient } from "./client/SilentFlowClient";
|
|
14
|
+
export { BaseClient } from "./client/BaseClient";
|
|
15
|
+
export {
|
|
16
|
+
AuthOptions,
|
|
17
|
+
SystemOptions,
|
|
18
|
+
LoggerOptions,
|
|
19
|
+
CacheOptions,
|
|
20
|
+
DEFAULT_SYSTEM_OPTIONS,
|
|
21
|
+
AzureCloudOptions,
|
|
22
|
+
ApplicationTelemetry,
|
|
23
|
+
} from "./config/ClientConfiguration";
|
|
24
|
+
export {
|
|
25
|
+
IAppTokenProvider,
|
|
26
|
+
AppTokenProviderParameters,
|
|
27
|
+
AppTokenProviderResult,
|
|
28
|
+
} from "./config/AppTokenProvider";
|
|
29
|
+
export { ClientConfiguration } from "./config/ClientConfiguration";
|
|
30
|
+
// Account
|
|
31
|
+
export { AccountInfo, ActiveAccountFilters } from "./account/AccountInfo";
|
|
32
|
+
export * as AuthToken from "./account/AuthToken";
|
|
33
|
+
export { TokenClaims } from "./account/TokenClaims";
|
|
34
|
+
export { TokenClaims as IdTokenClaims } from "./account/TokenClaims";
|
|
35
|
+
export { CcsCredential, CcsCredentialType } from "./account/CcsCredential";
|
|
36
|
+
export {
|
|
37
|
+
ClientInfo,
|
|
38
|
+
buildClientInfo,
|
|
39
|
+
buildClientInfoFromHomeAccountId,
|
|
40
|
+
} from "./account/ClientInfo";
|
|
41
|
+
// Authority
|
|
42
|
+
export { Authority } from "./authority/Authority";
|
|
43
|
+
export {
|
|
44
|
+
AuthorityOptions,
|
|
45
|
+
AzureCloudInstance,
|
|
46
|
+
} from "./authority/AuthorityOptions";
|
|
47
|
+
export { AuthorityFactory } from "./authority/AuthorityFactory";
|
|
48
|
+
export { AuthorityType } from "./authority/AuthorityType";
|
|
49
|
+
export { ProtocolMode } from "./authority/ProtocolMode";
|
|
50
|
+
export { OIDCOptions } from "./authority/OIDCOptions";
|
|
51
|
+
// Broker
|
|
52
|
+
export { INativeBrokerPlugin } from "./broker/nativeBroker/INativeBrokerPlugin";
|
|
53
|
+
// Cache
|
|
54
|
+
export { CacheManager, DefaultStorageClass } from "./cache/CacheManager";
|
|
55
|
+
export {
|
|
56
|
+
AccountCache,
|
|
57
|
+
AccessTokenCache,
|
|
58
|
+
IdTokenCache,
|
|
59
|
+
RefreshTokenCache,
|
|
60
|
+
AppMetadataCache,
|
|
61
|
+
CredentialFilter,
|
|
62
|
+
ValidCacheType,
|
|
63
|
+
ValidCredentialType,
|
|
64
|
+
TokenKeys,
|
|
65
|
+
} from "./cache/utils/CacheTypes";
|
|
66
|
+
export { CacheRecord } from "./cache/entities/CacheRecord";
|
|
67
|
+
export { CredentialEntity } from "./cache/entities/CredentialEntity";
|
|
68
|
+
export { AppMetadataEntity } from "./cache/entities/AppMetadataEntity";
|
|
69
|
+
export { AccountEntity } from "./cache/entities/AccountEntity";
|
|
70
|
+
export { IdTokenEntity } from "./cache/entities/IdTokenEntity";
|
|
71
|
+
export { AccessTokenEntity } from "./cache/entities/AccessTokenEntity";
|
|
72
|
+
export { RefreshTokenEntity } from "./cache/entities/RefreshTokenEntity";
|
|
73
|
+
export { ServerTelemetryEntity } from "./cache/entities/ServerTelemetryEntity";
|
|
74
|
+
export { AuthorityMetadataEntity } from "./cache/entities/AuthorityMetadataEntity";
|
|
75
|
+
export { ThrottlingEntity } from "./cache/entities/ThrottlingEntity";
|
|
76
|
+
export { ICachePlugin } from "./cache/interface/ICachePlugin";
|
|
77
|
+
export { TokenCacheContext } from "./cache/persistence/TokenCacheContext";
|
|
78
|
+
export { ISerializableTokenCache } from "./cache/interface/ISerializableTokenCache";
|
|
79
|
+
// Network Interface
|
|
80
|
+
export {
|
|
81
|
+
INetworkModule,
|
|
82
|
+
NetworkRequestOptions,
|
|
83
|
+
StubbedNetworkModule,
|
|
84
|
+
} from "./network/INetworkModule";
|
|
85
|
+
export {
|
|
86
|
+
NetworkManager,
|
|
87
|
+
NetworkResponse,
|
|
88
|
+
UrlToHttpRequestOptions,
|
|
89
|
+
} from "./network/NetworkManager";
|
|
90
|
+
export { ThrottlingUtils } from "./network/ThrottlingUtils";
|
|
91
|
+
export { RequestThumbprint } from "./network/RequestThumbprint";
|
|
92
|
+
export { IUri } from "./url/IUri";
|
|
93
|
+
export { UrlString } from "./url/UrlString";
|
|
94
|
+
// Crypto Interface
|
|
95
|
+
export {
|
|
96
|
+
ICrypto,
|
|
97
|
+
PkceCodes,
|
|
98
|
+
DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
99
|
+
SignedHttpRequestParameters,
|
|
100
|
+
} from "./crypto/ICrypto";
|
|
101
|
+
export { SignedHttpRequest } from "./crypto/SignedHttpRequest";
|
|
102
|
+
export { IGuidGenerator } from "./crypto/IGuidGenerator";
|
|
103
|
+
export { JoseHeader } from "./crypto/JoseHeader";
|
|
104
|
+
// Request
|
|
105
|
+
export { BaseAuthRequest } from "./request/BaseAuthRequest";
|
|
106
|
+
export { CommonAuthorizationUrlRequest } from "./request/CommonAuthorizationUrlRequest";
|
|
107
|
+
export { CommonAuthorizationCodeRequest } from "./request/CommonAuthorizationCodeRequest";
|
|
108
|
+
export { CommonRefreshTokenRequest } from "./request/CommonRefreshTokenRequest";
|
|
109
|
+
export { CommonClientCredentialRequest } from "./request/CommonClientCredentialRequest";
|
|
110
|
+
export { CommonOnBehalfOfRequest } from "./request/CommonOnBehalfOfRequest";
|
|
111
|
+
export { CommonSilentFlowRequest } from "./request/CommonSilentFlowRequest";
|
|
112
|
+
export { CommonDeviceCodeRequest } from "./request/CommonDeviceCodeRequest";
|
|
113
|
+
export { CommonEndSessionRequest } from "./request/CommonEndSessionRequest";
|
|
114
|
+
export { CommonUsernamePasswordRequest } from "./request/CommonUsernamePasswordRequest";
|
|
115
|
+
export { NativeRequest } from "./request/NativeRequest";
|
|
116
|
+
export { NativeSignOutRequest } from "./request/NativeSignOutRequest";
|
|
117
|
+
export { RequestParameterBuilder } from "./request/RequestParameterBuilder";
|
|
118
|
+
export { StoreInCache } from "./request/StoreInCache";
|
|
119
|
+
export { ClientAssertion } from "./account/ClientCredentials";
|
|
120
|
+
// Response
|
|
121
|
+
export { AzureRegion } from "./authority/AzureRegion";
|
|
122
|
+
export { AzureRegionConfiguration } from "./authority/AzureRegionConfiguration";
|
|
123
|
+
export { AuthenticationResult } from "./response/AuthenticationResult";
|
|
124
|
+
export { AuthorizationCodePayload } from "./response/AuthorizationCodePayload";
|
|
125
|
+
export { ServerAuthorizationCodeResponse } from "./response/ServerAuthorizationCodeResponse";
|
|
126
|
+
export { ServerAuthorizationTokenResponse } from "./response/ServerAuthorizationTokenResponse";
|
|
127
|
+
export { ExternalTokenResponse } from "./response/ExternalTokenResponse";
|
|
128
|
+
export {
|
|
129
|
+
DeviceCodeResponse,
|
|
130
|
+
ServerDeviceCodeResponse,
|
|
131
|
+
} from "./response/DeviceCodeResponse";
|
|
132
|
+
export { ResponseHandler } from "./response/ResponseHandler";
|
|
133
|
+
export { ScopeSet } from "./request/ScopeSet";
|
|
134
|
+
export { AuthenticationHeaderParser } from "./request/AuthenticationHeaderParser";
|
|
135
|
+
// Logger Callback
|
|
136
|
+
export { ILoggerCallback, LogLevel, Logger } from "./logger/Logger";
|
|
137
|
+
// Errors
|
|
138
|
+
export {
|
|
139
|
+
InteractionRequiredAuthError,
|
|
140
|
+
InteractionRequiredAuthErrorMessage,
|
|
141
|
+
} from "./error/InteractionRequiredAuthError";
|
|
142
|
+
export { AuthError, AuthErrorMessage } from "./error/AuthError";
|
|
143
|
+
export { ServerError } from "./error/ServerError";
|
|
144
|
+
export {
|
|
145
|
+
ClientAuthError,
|
|
146
|
+
ClientAuthErrorMessage,
|
|
147
|
+
} from "./error/ClientAuthError";
|
|
148
|
+
export {
|
|
149
|
+
ClientConfigurationError,
|
|
150
|
+
ClientConfigurationErrorMessage,
|
|
151
|
+
} from "./error/ClientConfigurationError";
|
|
152
|
+
// Constants and Utils
|
|
153
|
+
export {
|
|
154
|
+
Constants,
|
|
155
|
+
OIDC_DEFAULT_SCOPES,
|
|
156
|
+
PromptValue,
|
|
157
|
+
PersistentCacheKeys,
|
|
158
|
+
ServerResponseType,
|
|
159
|
+
ResponseMode,
|
|
160
|
+
CacheOutcome,
|
|
161
|
+
CredentialType,
|
|
162
|
+
CacheType,
|
|
163
|
+
CacheAccountType,
|
|
164
|
+
AuthenticationScheme,
|
|
165
|
+
CodeChallengeMethodValues,
|
|
166
|
+
SSOTypes,
|
|
167
|
+
PasswordGrantConstants,
|
|
168
|
+
ThrottlingConstants,
|
|
169
|
+
ClaimsRequestKeys,
|
|
170
|
+
HeaderNames,
|
|
171
|
+
AADServerParamKeys,
|
|
172
|
+
Errors,
|
|
173
|
+
THE_FAMILY_ID,
|
|
174
|
+
ONE_DAY_IN_MS,
|
|
175
|
+
GrantType,
|
|
176
|
+
AADAuthorityConstants,
|
|
177
|
+
HttpStatus,
|
|
178
|
+
} from "./utils/Constants";
|
|
179
|
+
export { StringUtils } from "./utils/StringUtils";
|
|
180
|
+
export { StringDict } from "./utils/MsalTypes";
|
|
181
|
+
export {
|
|
182
|
+
ProtocolUtils,
|
|
183
|
+
RequestStateObject,
|
|
184
|
+
LibraryStateObject,
|
|
185
|
+
} from "./utils/ProtocolUtils";
|
|
186
|
+
export { TimeUtils } from "./utils/TimeUtils";
|
|
187
|
+
export * from "./utils/FunctionWrappers";
|
|
188
|
+
// Server Telemetry
|
|
189
|
+
export { ServerTelemetryManager } from "./telemetry/server/ServerTelemetryManager";
|
|
190
|
+
export { ServerTelemetryRequest } from "./telemetry/server/ServerTelemetryRequest";
|
|
191
|
+
|
|
192
|
+
// Performance Telemetry
|
|
193
|
+
export {
|
|
194
|
+
IPerformanceClient,
|
|
195
|
+
PerformanceCallbackFunction,
|
|
196
|
+
InProgressPerformanceEvent,
|
|
197
|
+
QueueMeasurement,
|
|
198
|
+
} from "./telemetry/performance/IPerformanceClient";
|
|
199
|
+
export {
|
|
200
|
+
IntFields,
|
|
201
|
+
PerformanceEvent,
|
|
202
|
+
PerformanceEvents,
|
|
203
|
+
PerformanceEventStatus,
|
|
204
|
+
SubMeasurement,
|
|
205
|
+
} from "./telemetry/performance/PerformanceEvent";
|
|
206
|
+
export { IPerformanceMeasurement } from "./telemetry/performance/IPerformanceMeasurement";
|
|
207
|
+
export {
|
|
208
|
+
PerformanceClient,
|
|
209
|
+
PreQueueEvent,
|
|
210
|
+
} from "./telemetry/performance/PerformanceClient";
|
|
211
|
+
export { StubPerformanceClient } from "./telemetry/performance/StubPerformanceClient";
|
|
212
|
+
|
|
213
|
+
export { PopTokenGenerator } from "./crypto/PopTokenGenerator";
|
|
214
|
+
|
|
215
|
+
export { version } from "./packageMetadata";
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { LoggerOptions } from "../config/ClientConfiguration";
|
|
7
|
+
import { Constants } from "../utils/Constants";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Options for logger messages.
|
|
11
|
+
*/
|
|
12
|
+
export type LoggerMessageOptions = {
|
|
13
|
+
logLevel: LogLevel;
|
|
14
|
+
containsPii?: boolean;
|
|
15
|
+
context?: string;
|
|
16
|
+
correlationId?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Log message level.
|
|
21
|
+
*/
|
|
22
|
+
export enum LogLevel {
|
|
23
|
+
Error,
|
|
24
|
+
Warning,
|
|
25
|
+
Info,
|
|
26
|
+
Verbose,
|
|
27
|
+
Trace,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Callback to send the messages to.
|
|
32
|
+
*/
|
|
33
|
+
export interface ILoggerCallback {
|
|
34
|
+
(level: LogLevel, message: string, containsPii: boolean): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Class which facilitates logging of messages to a specific place.
|
|
39
|
+
*/
|
|
40
|
+
export class Logger {
|
|
41
|
+
// Correlation ID for request, usually set by user.
|
|
42
|
+
private correlationId: string;
|
|
43
|
+
|
|
44
|
+
// Current log level, defaults to info.
|
|
45
|
+
private level: LogLevel = LogLevel.Info;
|
|
46
|
+
|
|
47
|
+
// Boolean describing whether PII logging is allowed.
|
|
48
|
+
private piiLoggingEnabled: boolean;
|
|
49
|
+
|
|
50
|
+
// Callback to send messages to.
|
|
51
|
+
private localCallback: ILoggerCallback;
|
|
52
|
+
|
|
53
|
+
// Package name implementing this logger
|
|
54
|
+
private packageName: string;
|
|
55
|
+
|
|
56
|
+
// Package version implementing this logger
|
|
57
|
+
private packageVersion: string;
|
|
58
|
+
|
|
59
|
+
constructor(
|
|
60
|
+
loggerOptions: LoggerOptions,
|
|
61
|
+
packageName?: string,
|
|
62
|
+
packageVersion?: string
|
|
63
|
+
) {
|
|
64
|
+
const defaultLoggerCallback = () => {
|
|
65
|
+
return;
|
|
66
|
+
};
|
|
67
|
+
const setLoggerOptions =
|
|
68
|
+
loggerOptions || Logger.createDefaultLoggerOptions();
|
|
69
|
+
this.localCallback =
|
|
70
|
+
setLoggerOptions.loggerCallback || defaultLoggerCallback;
|
|
71
|
+
this.piiLoggingEnabled = setLoggerOptions.piiLoggingEnabled || false;
|
|
72
|
+
this.level =
|
|
73
|
+
typeof setLoggerOptions.logLevel === "number"
|
|
74
|
+
? setLoggerOptions.logLevel
|
|
75
|
+
: LogLevel.Info;
|
|
76
|
+
this.correlationId =
|
|
77
|
+
setLoggerOptions.correlationId || Constants.EMPTY_STRING;
|
|
78
|
+
this.packageName = packageName || Constants.EMPTY_STRING;
|
|
79
|
+
this.packageVersion = packageVersion || Constants.EMPTY_STRING;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private static createDefaultLoggerOptions(): LoggerOptions {
|
|
83
|
+
return {
|
|
84
|
+
loggerCallback: () => {
|
|
85
|
+
// allow users to not set loggerCallback
|
|
86
|
+
},
|
|
87
|
+
piiLoggingEnabled: false,
|
|
88
|
+
logLevel: LogLevel.Info,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Create new Logger with existing configurations.
|
|
94
|
+
*/
|
|
95
|
+
public clone(
|
|
96
|
+
packageName: string,
|
|
97
|
+
packageVersion: string,
|
|
98
|
+
correlationId?: string
|
|
99
|
+
): Logger {
|
|
100
|
+
return new Logger(
|
|
101
|
+
{
|
|
102
|
+
loggerCallback: this.localCallback,
|
|
103
|
+
piiLoggingEnabled: this.piiLoggingEnabled,
|
|
104
|
+
logLevel: this.level,
|
|
105
|
+
correlationId: correlationId || this.correlationId,
|
|
106
|
+
},
|
|
107
|
+
packageName,
|
|
108
|
+
packageVersion
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Log message with required options.
|
|
114
|
+
*/
|
|
115
|
+
private logMessage(
|
|
116
|
+
logMessage: string,
|
|
117
|
+
options: LoggerMessageOptions
|
|
118
|
+
): void {
|
|
119
|
+
if (
|
|
120
|
+
options.logLevel > this.level ||
|
|
121
|
+
(!this.piiLoggingEnabled && options.containsPii)
|
|
122
|
+
) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const timestamp = new Date().toUTCString();
|
|
126
|
+
|
|
127
|
+
// Add correlationId to logs if set, correlationId provided on log messages take precedence
|
|
128
|
+
const logHeader = `[${timestamp}] : [${
|
|
129
|
+
options.correlationId || this.correlationId || ""
|
|
130
|
+
}]`;
|
|
131
|
+
|
|
132
|
+
const log = `${logHeader} : ${this.packageName}@${
|
|
133
|
+
this.packageVersion
|
|
134
|
+
} : ${LogLevel[options.logLevel]} - ${logMessage}`;
|
|
135
|
+
// debug(`msal:${LogLevel[options.logLevel]}${options.containsPii ? "-Pii": Constants.EMPTY_STRING}${options.context ? `:${options.context}` : Constants.EMPTY_STRING}`)(logMessage);
|
|
136
|
+
this.executeCallback(
|
|
137
|
+
options.logLevel,
|
|
138
|
+
log,
|
|
139
|
+
options.containsPii || false
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Execute callback with message.
|
|
145
|
+
*/
|
|
146
|
+
executeCallback(
|
|
147
|
+
level: LogLevel,
|
|
148
|
+
message: string,
|
|
149
|
+
containsPii: boolean
|
|
150
|
+
): void {
|
|
151
|
+
if (this.localCallback) {
|
|
152
|
+
this.localCallback(level, message, containsPii);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Logs error messages.
|
|
158
|
+
*/
|
|
159
|
+
error(message: string, correlationId?: string): void {
|
|
160
|
+
this.logMessage(message, {
|
|
161
|
+
logLevel: LogLevel.Error,
|
|
162
|
+
containsPii: false,
|
|
163
|
+
correlationId: correlationId || Constants.EMPTY_STRING,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Logs error messages with PII.
|
|
169
|
+
*/
|
|
170
|
+
errorPii(message: string, correlationId?: string): void {
|
|
171
|
+
this.logMessage(message, {
|
|
172
|
+
logLevel: LogLevel.Error,
|
|
173
|
+
containsPii: true,
|
|
174
|
+
correlationId: correlationId || Constants.EMPTY_STRING,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Logs warning messages.
|
|
180
|
+
*/
|
|
181
|
+
warning(message: string, correlationId?: string): void {
|
|
182
|
+
this.logMessage(message, {
|
|
183
|
+
logLevel: LogLevel.Warning,
|
|
184
|
+
containsPii: false,
|
|
185
|
+
correlationId: correlationId || Constants.EMPTY_STRING,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Logs warning messages with PII.
|
|
191
|
+
*/
|
|
192
|
+
warningPii(message: string, correlationId?: string): void {
|
|
193
|
+
this.logMessage(message, {
|
|
194
|
+
logLevel: LogLevel.Warning,
|
|
195
|
+
containsPii: true,
|
|
196
|
+
correlationId: correlationId || Constants.EMPTY_STRING,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Logs info messages.
|
|
202
|
+
*/
|
|
203
|
+
info(message: string, correlationId?: string): void {
|
|
204
|
+
this.logMessage(message, {
|
|
205
|
+
logLevel: LogLevel.Info,
|
|
206
|
+
containsPii: false,
|
|
207
|
+
correlationId: correlationId || Constants.EMPTY_STRING,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Logs info messages with PII.
|
|
213
|
+
*/
|
|
214
|
+
infoPii(message: string, correlationId?: string): void {
|
|
215
|
+
this.logMessage(message, {
|
|
216
|
+
logLevel: LogLevel.Info,
|
|
217
|
+
containsPii: true,
|
|
218
|
+
correlationId: correlationId || Constants.EMPTY_STRING,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Logs verbose messages.
|
|
224
|
+
*/
|
|
225
|
+
verbose(message: string, correlationId?: string): void {
|
|
226
|
+
this.logMessage(message, {
|
|
227
|
+
logLevel: LogLevel.Verbose,
|
|
228
|
+
containsPii: false,
|
|
229
|
+
correlationId: correlationId || Constants.EMPTY_STRING,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Logs verbose messages with PII.
|
|
235
|
+
*/
|
|
236
|
+
verbosePii(message: string, correlationId?: string): void {
|
|
237
|
+
this.logMessage(message, {
|
|
238
|
+
logLevel: LogLevel.Verbose,
|
|
239
|
+
containsPii: true,
|
|
240
|
+
correlationId: correlationId || Constants.EMPTY_STRING,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Logs trace messages.
|
|
246
|
+
*/
|
|
247
|
+
trace(message: string, correlationId?: string): void {
|
|
248
|
+
this.logMessage(message, {
|
|
249
|
+
logLevel: LogLevel.Trace,
|
|
250
|
+
containsPii: false,
|
|
251
|
+
correlationId: correlationId || Constants.EMPTY_STRING,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Logs trace messages with PII.
|
|
257
|
+
*/
|
|
258
|
+
tracePii(message: string, correlationId?: string): void {
|
|
259
|
+
this.logMessage(message, {
|
|
260
|
+
logLevel: LogLevel.Trace,
|
|
261
|
+
containsPii: true,
|
|
262
|
+
correlationId: correlationId || Constants.EMPTY_STRING,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Returns whether PII Logging is enabled or not.
|
|
268
|
+
*/
|
|
269
|
+
isPiiLoggingEnabled(): boolean {
|
|
270
|
+
return this.piiLoggingEnabled || false;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { AuthError } from "../error/AuthError";
|
|
7
|
+
import { NetworkResponse } from "./NetworkManager";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Options allowed by network request APIs.
|
|
11
|
+
*/
|
|
12
|
+
export type NetworkRequestOptions = {
|
|
13
|
+
headers?: Record<string, string>;
|
|
14
|
+
body?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Client network interface to send backend requests.
|
|
19
|
+
* @interface
|
|
20
|
+
*/
|
|
21
|
+
export interface INetworkModule {
|
|
22
|
+
/**
|
|
23
|
+
* Interface function for async network "GET" requests. Based on the Fetch standard: https://fetch.spec.whatwg.org/
|
|
24
|
+
* @param url
|
|
25
|
+
* @param requestParams
|
|
26
|
+
* @param enableCaching
|
|
27
|
+
*/
|
|
28
|
+
sendGetRequestAsync<T>(
|
|
29
|
+
url: string,
|
|
30
|
+
options?: NetworkRequestOptions,
|
|
31
|
+
cancellationToken?: number
|
|
32
|
+
): Promise<NetworkResponse<T>>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Interface function for async network "POST" requests. Based on the Fetch standard: https://fetch.spec.whatwg.org/
|
|
36
|
+
* @param url
|
|
37
|
+
* @param requestParams
|
|
38
|
+
* @param enableCaching
|
|
39
|
+
*/
|
|
40
|
+
sendPostRequestAsync<T>(
|
|
41
|
+
url: string,
|
|
42
|
+
options?: NetworkRequestOptions
|
|
43
|
+
): Promise<NetworkResponse<T>>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const StubbedNetworkModule: INetworkModule = {
|
|
47
|
+
sendGetRequestAsync: () => {
|
|
48
|
+
const notImplErr =
|
|
49
|
+
"Network interface - sendGetRequestAsync() has not been implemented for the Network interface.";
|
|
50
|
+
return Promise.reject(AuthError.createUnexpectedError(notImplErr));
|
|
51
|
+
},
|
|
52
|
+
sendPostRequestAsync: () => {
|
|
53
|
+
const notImplErr =
|
|
54
|
+
"Network interface - sendPostRequestAsync() has not been implemented for the Network interface.";
|
|
55
|
+
return Promise.reject(AuthError.createUnexpectedError(notImplErr));
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { INetworkModule, NetworkRequestOptions } from "./INetworkModule";
|
|
7
|
+
import { RequestThumbprint } from "./RequestThumbprint";
|
|
8
|
+
import { ThrottlingUtils } from "./ThrottlingUtils";
|
|
9
|
+
import { CacheManager } from "../cache/CacheManager";
|
|
10
|
+
import { AuthError } from "../error/AuthError";
|
|
11
|
+
import { ClientAuthError } from "../error/ClientAuthError";
|
|
12
|
+
import { ServerAuthorizationTokenResponse } from "../response/ServerAuthorizationTokenResponse";
|
|
13
|
+
|
|
14
|
+
export type NetworkResponse<T> = {
|
|
15
|
+
headers: Record<string, string>;
|
|
16
|
+
body: T;
|
|
17
|
+
status: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type UrlToHttpRequestOptions = {
|
|
21
|
+
protocol: string;
|
|
22
|
+
hostname: string;
|
|
23
|
+
hash: string;
|
|
24
|
+
search: string;
|
|
25
|
+
pathname: string;
|
|
26
|
+
path: string;
|
|
27
|
+
href: string;
|
|
28
|
+
port?: number;
|
|
29
|
+
auth?: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export class NetworkManager {
|
|
34
|
+
private networkClient: INetworkModule;
|
|
35
|
+
private cacheManager: CacheManager;
|
|
36
|
+
|
|
37
|
+
constructor(networkClient: INetworkModule, cacheManager: CacheManager) {
|
|
38
|
+
this.networkClient = networkClient;
|
|
39
|
+
this.cacheManager = cacheManager;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Wraps sendPostRequestAsync with necessary preflight and postflight logic
|
|
44
|
+
* @param thumbprint
|
|
45
|
+
* @param tokenEndpoint
|
|
46
|
+
* @param options
|
|
47
|
+
*/
|
|
48
|
+
async sendPostRequest<T extends ServerAuthorizationTokenResponse>(
|
|
49
|
+
thumbprint: RequestThumbprint,
|
|
50
|
+
tokenEndpoint: string,
|
|
51
|
+
options: NetworkRequestOptions
|
|
52
|
+
): Promise<NetworkResponse<T>> {
|
|
53
|
+
ThrottlingUtils.preProcess(this.cacheManager, thumbprint);
|
|
54
|
+
|
|
55
|
+
let response;
|
|
56
|
+
try {
|
|
57
|
+
response = await this.networkClient.sendPostRequestAsync<T>(
|
|
58
|
+
tokenEndpoint,
|
|
59
|
+
options
|
|
60
|
+
);
|
|
61
|
+
} catch (e) {
|
|
62
|
+
if (e instanceof AuthError) {
|
|
63
|
+
throw e;
|
|
64
|
+
} else {
|
|
65
|
+
throw ClientAuthError.createNetworkError(
|
|
66
|
+
tokenEndpoint,
|
|
67
|
+
e as string
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response);
|
|
73
|
+
|
|
74
|
+
return response;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { AuthenticationScheme } from "../utils/Constants";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Type representing a unique request thumbprint.
|
|
10
|
+
*/
|
|
11
|
+
export type RequestThumbprint = {
|
|
12
|
+
clientId: string;
|
|
13
|
+
authority: string;
|
|
14
|
+
scopes: Array<string>;
|
|
15
|
+
homeAccountIdentifier?: string;
|
|
16
|
+
claims?: string;
|
|
17
|
+
authenticationScheme?: AuthenticationScheme;
|
|
18
|
+
resourceRequestMethod?: string;
|
|
19
|
+
resourceRequestUri?: string;
|
|
20
|
+
shrClaims?: string;
|
|
21
|
+
sshKid?: string;
|
|
22
|
+
};
|