@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":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/logger/Logger.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import { LoggerOptions } from "../config/ClientConfiguration";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare type LoggerMessageOptions = {
|
|
6
6
|
logLevel: LogLevel;
|
|
7
|
-
correlationId?: string;
|
|
8
7
|
containsPii?: boolean;
|
|
9
8
|
context?: string;
|
|
9
|
+
correlationId?: string;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Log message level.
|
|
@@ -15,7 +15,8 @@ export declare enum LogLevel {
|
|
|
15
15
|
Error = 0,
|
|
16
16
|
Warning = 1,
|
|
17
17
|
Info = 2,
|
|
18
|
-
Verbose = 3
|
|
18
|
+
Verbose = 3,
|
|
19
|
+
Trace = 4
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Callback to send the messages to.
|
|
@@ -37,7 +38,7 @@ export declare class Logger {
|
|
|
37
38
|
/**
|
|
38
39
|
* Create new Logger with existing configurations.
|
|
39
40
|
*/
|
|
40
|
-
clone(packageName: string, packageVersion: string): Logger;
|
|
41
|
+
clone(packageName: string, packageVersion: string, correlationId?: string): Logger;
|
|
41
42
|
/**
|
|
42
43
|
* Log message with required options.
|
|
43
44
|
*/
|
|
@@ -78,6 +79,14 @@ export declare class Logger {
|
|
|
78
79
|
* Logs verbose messages with PII.
|
|
79
80
|
*/
|
|
80
81
|
verbosePii(message: string, correlationId?: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* Logs trace messages.
|
|
84
|
+
*/
|
|
85
|
+
trace(message: string, correlationId?: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* Logs trace messages with PII.
|
|
88
|
+
*/
|
|
89
|
+
tracePii(message: string, correlationId?: string): void;
|
|
81
90
|
/**
|
|
82
91
|
* Returns whether PII Logging is enabled or not.
|
|
83
92
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/logger/Logger.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D;;GAEG;AACH,oBAAY,oBAAoB,GAAG;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/logger/Logger.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D;;GAEG;AACH,oBAAY,oBAAoB,GAAG;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;CACzB,CAAC;AAEF;;GAEG;AACH,oBAAY,QAAQ;IAChB,KAAK,IAAA;IACL,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,KAAK,IAAA;CACR;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;CAClE;AAED;;GAEG;AACH,qBAAa,MAAM;IAGf,OAAO,CAAC,aAAa,CAAS;IAG9B,OAAO,CAAC,KAAK,CAA2B;IAGxC,OAAO,CAAC,iBAAiB,CAAU;IAGnC,OAAO,CAAC,aAAa,CAAkB;IAGvC,OAAO,CAAC,WAAW,CAAS;IAG5B,OAAO,CAAC,cAAc,CAAS;gBAEnB,aAAa,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;IAWvF;;OAEG;IACI,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GA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Utils } from '../utils/StringUtils.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
|
+
* Log message level.
|
|
12
|
+
*/
|
|
13
|
+
var LogLevel;
|
|
14
|
+
(function (LogLevel) {
|
|
15
|
+
LogLevel[LogLevel["Error"] = 0] = "Error";
|
|
16
|
+
LogLevel[LogLevel["Warning"] = 1] = "Warning";
|
|
17
|
+
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
18
|
+
LogLevel[LogLevel["Verbose"] = 3] = "Verbose";
|
|
19
|
+
LogLevel[LogLevel["Trace"] = 4] = "Trace";
|
|
20
|
+
})(LogLevel || (LogLevel = {}));
|
|
21
|
+
/**
|
|
22
|
+
* Class which facilitates logging of messages to a specific place.
|
|
23
|
+
*/
|
|
24
|
+
var Logger = /** @class */ (function () {
|
|
25
|
+
function Logger(loggerOptions, packageName, packageVersion) {
|
|
26
|
+
// Current log level, defaults to info.
|
|
27
|
+
this.level = LogLevel.Info;
|
|
28
|
+
var defaultLoggerCallback = function () { };
|
|
29
|
+
this.localCallback = loggerOptions.loggerCallback || defaultLoggerCallback;
|
|
30
|
+
this.piiLoggingEnabled = loggerOptions.piiLoggingEnabled || false;
|
|
31
|
+
this.level = loggerOptions.logLevel || LogLevel.Info;
|
|
32
|
+
this.correlationId = loggerOptions.correlationId || "";
|
|
33
|
+
this.packageName = packageName || Constants.EMPTY_STRING;
|
|
34
|
+
this.packageVersion = packageVersion || Constants.EMPTY_STRING;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create new Logger with existing configurations.
|
|
38
|
+
*/
|
|
39
|
+
Logger.prototype.clone = function (packageName, packageVersion, correlationId) {
|
|
40
|
+
return new Logger({ loggerCallback: this.localCallback, piiLoggingEnabled: this.piiLoggingEnabled, logLevel: this.level, correlationId: correlationId || this.correlationId }, packageName, packageVersion);
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Log message with required options.
|
|
44
|
+
*/
|
|
45
|
+
Logger.prototype.logMessage = function (logMessage, options) {
|
|
46
|
+
if ((options.logLevel > this.level) || (!this.piiLoggingEnabled && options.containsPii)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
var timestamp = new Date().toUTCString();
|
|
50
|
+
// Add correlationId to logs if set, correlationId provided on log messages take precedence
|
|
51
|
+
var logHeader;
|
|
52
|
+
if (!StringUtils.isEmpty(options.correlationId)) {
|
|
53
|
+
logHeader = "[" + timestamp + "] : [" + options.correlationId + "]";
|
|
54
|
+
}
|
|
55
|
+
else if (!StringUtils.isEmpty(this.correlationId)) {
|
|
56
|
+
logHeader = "[" + timestamp + "] : [" + this.correlationId + "]";
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
logHeader = "[" + timestamp + "]";
|
|
60
|
+
}
|
|
61
|
+
var log = logHeader + " : " + this.packageName + "@" + this.packageVersion + " : " + LogLevel[options.logLevel] + " - " + logMessage;
|
|
62
|
+
// debug(`msal:${LogLevel[options.logLevel]}${options.containsPii ? "-Pii": ""}${options.context ? `:${options.context}` : ""}`)(logMessage);
|
|
63
|
+
this.executeCallback(options.logLevel, log, options.containsPii || false);
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Execute callback with message.
|
|
67
|
+
*/
|
|
68
|
+
Logger.prototype.executeCallback = function (level, message, containsPii) {
|
|
69
|
+
if (this.localCallback) {
|
|
70
|
+
this.localCallback(level, message, containsPii);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Logs error messages.
|
|
75
|
+
*/
|
|
76
|
+
Logger.prototype.error = function (message, correlationId) {
|
|
77
|
+
this.logMessage(message, {
|
|
78
|
+
logLevel: LogLevel.Error,
|
|
79
|
+
containsPii: false,
|
|
80
|
+
correlationId: correlationId || ""
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Logs error messages with PII.
|
|
85
|
+
*/
|
|
86
|
+
Logger.prototype.errorPii = function (message, correlationId) {
|
|
87
|
+
this.logMessage(message, {
|
|
88
|
+
logLevel: LogLevel.Error,
|
|
89
|
+
containsPii: true,
|
|
90
|
+
correlationId: correlationId || ""
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Logs warning messages.
|
|
95
|
+
*/
|
|
96
|
+
Logger.prototype.warning = function (message, correlationId) {
|
|
97
|
+
this.logMessage(message, {
|
|
98
|
+
logLevel: LogLevel.Warning,
|
|
99
|
+
containsPii: false,
|
|
100
|
+
correlationId: correlationId || ""
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Logs warning messages with PII.
|
|
105
|
+
*/
|
|
106
|
+
Logger.prototype.warningPii = function (message, correlationId) {
|
|
107
|
+
this.logMessage(message, {
|
|
108
|
+
logLevel: LogLevel.Warning,
|
|
109
|
+
containsPii: true,
|
|
110
|
+
correlationId: correlationId || ""
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Logs info messages.
|
|
115
|
+
*/
|
|
116
|
+
Logger.prototype.info = function (message, correlationId) {
|
|
117
|
+
this.logMessage(message, {
|
|
118
|
+
logLevel: LogLevel.Info,
|
|
119
|
+
containsPii: false,
|
|
120
|
+
correlationId: correlationId || ""
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Logs info messages with PII.
|
|
125
|
+
*/
|
|
126
|
+
Logger.prototype.infoPii = function (message, correlationId) {
|
|
127
|
+
this.logMessage(message, {
|
|
128
|
+
logLevel: LogLevel.Info,
|
|
129
|
+
containsPii: true,
|
|
130
|
+
correlationId: correlationId || ""
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Logs verbose messages.
|
|
135
|
+
*/
|
|
136
|
+
Logger.prototype.verbose = function (message, correlationId) {
|
|
137
|
+
this.logMessage(message, {
|
|
138
|
+
logLevel: LogLevel.Verbose,
|
|
139
|
+
containsPii: false,
|
|
140
|
+
correlationId: correlationId || ""
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Logs verbose messages with PII.
|
|
145
|
+
*/
|
|
146
|
+
Logger.prototype.verbosePii = function (message, correlationId) {
|
|
147
|
+
this.logMessage(message, {
|
|
148
|
+
logLevel: LogLevel.Verbose,
|
|
149
|
+
containsPii: true,
|
|
150
|
+
correlationId: correlationId || ""
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Logs trace messages.
|
|
155
|
+
*/
|
|
156
|
+
Logger.prototype.trace = function (message, correlationId) {
|
|
157
|
+
this.logMessage(message, {
|
|
158
|
+
logLevel: LogLevel.Trace,
|
|
159
|
+
containsPii: false,
|
|
160
|
+
correlationId: correlationId || ""
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Logs trace messages with PII.
|
|
165
|
+
*/
|
|
166
|
+
Logger.prototype.tracePii = function (message, correlationId) {
|
|
167
|
+
this.logMessage(message, {
|
|
168
|
+
logLevel: LogLevel.Trace,
|
|
169
|
+
containsPii: true,
|
|
170
|
+
correlationId: correlationId || ""
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Returns whether PII Logging is enabled or not.
|
|
175
|
+
*/
|
|
176
|
+
Logger.prototype.isPiiLoggingEnabled = function () {
|
|
177
|
+
return this.piiLoggingEnabled || false;
|
|
178
|
+
};
|
|
179
|
+
return Logger;
|
|
180
|
+
}());
|
|
181
|
+
|
|
182
|
+
export { LogLevel, Logger };
|
|
183
|
+
//# sourceMappingURL=Logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.js","sources":["../../src/logger/Logger.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { LoggerOptions } from \"../config/ClientConfiguration\";\nimport { Constants } from \"../utils/Constants\";\n\n/**\n * Options for logger messages.\n */\nexport type LoggerMessageOptions = {\n logLevel: LogLevel,\n containsPii?: boolean,\n context?: string,\n correlationId?: string\n};\n\n/**\n * Log message level.\n */\nexport enum LogLevel {\n Error,\n Warning,\n Info,\n Verbose,\n Trace\n}\n\n/**\n * Callback to send the messages to.\n */\nexport interface ILoggerCallback {\n (level: LogLevel, message: string, containsPii: boolean): void;\n}\n\n/**\n * Class which facilitates logging of messages to a specific place.\n */\nexport class Logger {\n\n // Correlation ID for request, usually set by user.\n private correlationId: string;\n\n // Current log level, defaults to info.\n private level: LogLevel = LogLevel.Info;\n\n // Boolean describing whether PII logging is allowed.\n private piiLoggingEnabled: boolean;\n\n // Callback to send messages to.\n private localCallback: ILoggerCallback;\n\n // Package name implementing this logger\n private packageName: string;\n\n // Package version implementing this logger\n private packageVersion: string;\n\n constructor(loggerOptions: LoggerOptions, packageName?: string, packageVersion?: string) {\n const defaultLoggerCallback = () => {};\n this.localCallback = loggerOptions.loggerCallback || defaultLoggerCallback;\n this.piiLoggingEnabled = loggerOptions.piiLoggingEnabled || false;\n this.level = loggerOptions.logLevel || LogLevel.Info;\n this.correlationId = loggerOptions.correlationId || \"\";\n\n this.packageName = packageName || Constants.EMPTY_STRING;\n this.packageVersion = packageVersion || Constants.EMPTY_STRING;\n }\n\n /**\n * Create new Logger with existing configurations.\n */\n public clone(packageName: string, packageVersion: string, correlationId?: string): Logger {\n return new Logger({loggerCallback: this.localCallback, piiLoggingEnabled: this.piiLoggingEnabled, logLevel: this.level, correlationId: correlationId || this.correlationId}, packageName, packageVersion);\n }\n\n /**\n * Log message with required options.\n */\n private logMessage(logMessage: string, options: LoggerMessageOptions): void {\n if ((options.logLevel > this.level) || (!this.piiLoggingEnabled && options.containsPii)) {\n return;\n }\n const timestamp = new Date().toUTCString();\n\n // Add correlationId to logs if set, correlationId provided on log messages take precedence\n let logHeader: string;\n if (!StringUtils.isEmpty(options.correlationId)) {\n logHeader = `[${timestamp}] : [${options.correlationId}]`;\n } else if (!StringUtils.isEmpty(this.correlationId)) {\n logHeader = `[${timestamp}] : [${this.correlationId}]`;\n } else {\n logHeader = `[${timestamp}]`;\n }\n\n const log = `${logHeader} : ${this.packageName}@${this.packageVersion} : ${LogLevel[options.logLevel]} - ${logMessage}`;\n // debug(`msal:${LogLevel[options.logLevel]}${options.containsPii ? \"-Pii\": \"\"}${options.context ? `:${options.context}` : \"\"}`)(logMessage);\n this.executeCallback(options.logLevel, log, options.containsPii || false);\n }\n\n /**\n * Execute callback with message.\n */\n executeCallback(level: LogLevel, message: string, containsPii: boolean): void {\n if (this.localCallback) {\n this.localCallback(level, message, containsPii);\n }\n }\n\n /**\n * Logs error messages.\n */\n error(message: string, correlationId?: string): void {\n this.logMessage(message, {\n logLevel: LogLevel.Error,\n containsPii: false,\n correlationId: correlationId || \"\"\n });\n }\n\n /**\n * Logs error messages with PII.\n */\n errorPii(message: string, correlationId?: string): void {\n this.logMessage(message, {\n logLevel: LogLevel.Error,\n containsPii: true,\n correlationId: correlationId || \"\"\n });\n }\n\n /**\n * Logs warning messages.\n */\n warning(message: string, correlationId?: string): void {\n this.logMessage(message, {\n logLevel: LogLevel.Warning,\n containsPii: false,\n correlationId: correlationId || \"\"\n });\n }\n\n /**\n * Logs warning messages with PII.\n */\n warningPii(message: string, correlationId?: string): void {\n this.logMessage(message, {\n logLevel: LogLevel.Warning,\n containsPii: true,\n correlationId: correlationId || \"\"\n });\n }\n\n /**\n * Logs info messages.\n */\n info(message: string, correlationId?: string): void {\n this.logMessage(message, {\n logLevel: LogLevel.Info,\n containsPii: false,\n correlationId: correlationId || \"\"\n });\n }\n\n /**\n * Logs info messages with PII.\n */\n infoPii(message: string, correlationId?: string): void {\n this.logMessage(message, {\n logLevel: LogLevel.Info,\n containsPii: true,\n correlationId: correlationId || \"\"\n });\n }\n\n /**\n * Logs verbose messages.\n */\n verbose(message: string, correlationId?: string): void {\n this.logMessage(message, {\n logLevel: LogLevel.Verbose,\n containsPii: false,\n correlationId: correlationId || \"\"\n });\n }\n\n /**\n * Logs verbose messages with PII.\n */\n verbosePii(message: string, correlationId?: string): void {\n this.logMessage(message, {\n logLevel: LogLevel.Verbose,\n containsPii: true,\n correlationId: correlationId || \"\"\n });\n }\n\n /**\n * Logs trace messages.\n */\n trace(message: string, correlationId?: string): void {\n this.logMessage(message, {\n logLevel: LogLevel.Trace,\n containsPii: false,\n correlationId: correlationId || \"\"\n });\n }\n\n /**\n * Logs trace messages with PII.\n */\n tracePii(message: string, correlationId?: string): void {\n this.logMessage(message, {\n logLevel: LogLevel.Trace,\n containsPii: true,\n correlationId: correlationId || \"\"\n });\n }\n\n /**\n * Returns whether PII Logging is enabled or not.\n */\n isPiiLoggingEnabled(): boolean {\n return this.piiLoggingEnabled || false;\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;AAmBA;;;IAGY;AAAZ,WAAY,QAAQ;IAChB,yCAAK,CAAA;IACL,6CAAO,CAAA;IACP,uCAAI,CAAA;IACJ,6CAAO,CAAA;IACP,yCAAK,CAAA;AACT,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB;AASD;;;;IAuBI,gBAAY,aAA4B,EAAE,WAAoB,EAAE,cAAuB;;QAd/E,UAAK,GAAa,QAAQ,CAAC,IAAI,CAAC;QAepC,IAAM,qBAAqB,GAAG,eAAQ,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC,cAAc,IAAI,qBAAqB,CAAC;QAC3E,IAAI,CAAC,iBAAiB,GAAG,aAAa,CAAC,iBAAiB,IAAI,KAAK,CAAC;QAClE,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC;QACrD,IAAI,CAAC,aAAa,GAAG,aAA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;;IAKD,oCAAmB,GAAnB;QACI,OAAO,IAAI,CAAC,iBAAiB,IAAI,KAAK,CAAC;KAC1C;IACL,aAAC;AAAD,CAAC;;;;"}
|
|
@@ -17,7 +17,7 @@ export interface INetworkModule {
|
|
|
17
17
|
* @param requestParams
|
|
18
18
|
* @param enableCaching
|
|
19
19
|
*/
|
|
20
|
-
sendGetRequestAsync<T>(url: string, options?: NetworkRequestOptions): Promise<NetworkResponse<T>>;
|
|
20
|
+
sendGetRequestAsync<T>(url: string, options?: NetworkRequestOptions, cancellationToken?: number): Promise<NetworkResponse<T>>;
|
|
21
21
|
/**
|
|
22
22
|
* Interface function for async network "POST" requests. Based on the Fetch standard: https://fetch.spec.whatwg.org/
|
|
23
23
|
* @param url
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"INetworkModule.d.ts","sourceRoot":"","sources":["../../src/network/INetworkModule.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,oBAAY,qBAAqB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,cAAc;IAE3B;;;;;OAKG;IACH,mBAAmB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"INetworkModule.d.ts","sourceRoot":"","sources":["../../src/network/INetworkModule.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,oBAAY,qBAAqB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,cAAc;IAE3B;;;;;OAKG;IACH,mBAAmB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9H;;;;;OAKG;IACH,oBAAoB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;CACtG;AAED,eAAO,MAAM,oBAAoB,EAAE,cASlC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*! @azure/msal-common v4.5.1 2021-08-02 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { AuthError } from '../error/AuthError.js';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
+
* Licensed under the MIT License.
|
|
8
|
+
*/
|
|
9
|
+
var StubbedNetworkModule = {
|
|
10
|
+
sendGetRequestAsync: function () {
|
|
11
|
+
var notImplErr = "Network interface - sendGetRequestAsync() has not been implemented for the Network interface.";
|
|
12
|
+
return Promise.reject(AuthError.createUnexpectedError(notImplErr));
|
|
13
|
+
},
|
|
14
|
+
sendPostRequestAsync: function () {
|
|
15
|
+
var notImplErr = "Network interface - sendPostRequestAsync() has not been implemented for the Network interface.";
|
|
16
|
+
return Promise.reject(AuthError.createUnexpectedError(notImplErr));
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { StubbedNetworkModule };
|
|
21
|
+
//# sourceMappingURL=INetworkModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"INetworkModule.js","sources":["../../src/network/INetworkModule.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthError } from \"../error/AuthError\";\nimport { NetworkResponse } from \"./NetworkManager\";\n\n/**\n * Options allowed by network request APIs.\n */\nexport type NetworkRequestOptions = {\n headers?: Record<string, string>,\n body?: string;\n};\n\n/**\n * Client network interface to send backend requests.\n * @interface\n */\nexport interface INetworkModule {\n\n /**\n * Interface function for async network \"GET\" requests. Based on the Fetch standard: https://fetch.spec.whatwg.org/\n * @param url\n * @param requestParams\n * @param enableCaching\n */\n sendGetRequestAsync<T>(url: string, options?: NetworkRequestOptions, cancellationToken?: number): Promise<NetworkResponse<T>>;\n\n /**\n * Interface function for async network \"POST\" requests. Based on the Fetch standard: https://fetch.spec.whatwg.org/\n * @param url\n * @param requestParams\n * @param enableCaching\n */\n sendPostRequestAsync<T>(url: string, options?: NetworkRequestOptions): Promise<NetworkResponse<T>>;\n}\n\nexport const StubbedNetworkModule: INetworkModule = {\n sendGetRequestAsync: () => {\n const notImplErr = \"Network interface - sendGetRequestAsync() has not been implemented for the Network interface.\";\n return Promise.reject(AuthError.createUnexpectedError(notImplErr));\n },\n sendPostRequestAsync: () => {\n const notImplErr = \"Network interface - sendPostRequestAsync() has not been implemented for the Network interface.\";\n return Promise.reject(AuthError.createUnexpectedError(notImplErr));\n }\n};\n"],"names":[],"mappings":";;;;AAAA;;;;IAuCa,oBAAoB,GAAmB;IAChD,mBAAmB,EAAE;QACjB,IAAM,UAAU,GAAG,+FAA+F,CAAC;QACnH,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;KACtE;IACD,oBAAoB,EAAE;QAClB,IAAM,UAAU,GAAG,gGAAgG,CAAC;QACpH,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;KACtE;;;;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*! @azure/msal-common v4.5.1 2021-08-02 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
4
|
+
import { ThrottlingUtils } from './ThrottlingUtils.js';
|
|
5
|
+
import { ClientAuthError } from '../error/ClientAuthError.js';
|
|
6
|
+
import { AuthError } from '../error/AuthError.js';
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
+
* Licensed under the MIT License.
|
|
11
|
+
*/
|
|
12
|
+
var NetworkManager = /** @class */ (function () {
|
|
13
|
+
function NetworkManager(networkClient, cacheManager) {
|
|
14
|
+
this.networkClient = networkClient;
|
|
15
|
+
this.cacheManager = cacheManager;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Wraps sendPostRequestAsync with necessary preflight and postflight logic
|
|
19
|
+
* @param thumbprint
|
|
20
|
+
* @param tokenEndpoint
|
|
21
|
+
* @param options
|
|
22
|
+
*/
|
|
23
|
+
NetworkManager.prototype.sendPostRequest = function (thumbprint, tokenEndpoint, options) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25
|
+
var response, e_1;
|
|
26
|
+
return __generator(this, function (_a) {
|
|
27
|
+
switch (_a.label) {
|
|
28
|
+
case 0:
|
|
29
|
+
ThrottlingUtils.preProcess(this.cacheManager, thumbprint);
|
|
30
|
+
_a.label = 1;
|
|
31
|
+
case 1:
|
|
32
|
+
_a.trys.push([1, 3, , 4]);
|
|
33
|
+
return [4 /*yield*/, this.networkClient.sendPostRequestAsync(tokenEndpoint, options)];
|
|
34
|
+
case 2:
|
|
35
|
+
response = _a.sent();
|
|
36
|
+
return [3 /*break*/, 4];
|
|
37
|
+
case 3:
|
|
38
|
+
e_1 = _a.sent();
|
|
39
|
+
if (e_1 instanceof AuthError) {
|
|
40
|
+
throw e_1;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
throw ClientAuthError.createNetworkError(tokenEndpoint, e_1);
|
|
44
|
+
}
|
|
45
|
+
case 4:
|
|
46
|
+
ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response);
|
|
47
|
+
return [2 /*return*/, response];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
return NetworkManager;
|
|
53
|
+
}());
|
|
54
|
+
|
|
55
|
+
export { NetworkManager };
|
|
56
|
+
//# sourceMappingURL=NetworkManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkManager.js","sources":["../../src/network/NetworkManager.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { INetworkModule, NetworkRequestOptions } from \"./INetworkModule\";\nimport { RequestThumbprint } from \"./RequestThumbprint\";\nimport { ThrottlingUtils } from \"./ThrottlingUtils\";\nimport { CacheManager } from \"../cache/CacheManager\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { AuthError } from \"../error/AuthError\";\n\nexport type NetworkResponse<T> = {\n headers: Record<string, string>;\n body: T;\n status: number;\n};\n\nexport class NetworkManager {\n private networkClient: INetworkModule;\n private cacheManager: CacheManager;\n\n constructor(networkClient: INetworkModule, cacheManager: CacheManager) {\n this.networkClient = networkClient;\n this.cacheManager = cacheManager;\n }\n\n /**\n * Wraps sendPostRequestAsync with necessary preflight and postflight logic\n * @param thumbprint\n * @param tokenEndpoint\n * @param options\n */\n async sendPostRequest<T>(thumbprint: RequestThumbprint, tokenEndpoint: string, options: NetworkRequestOptions): Promise<NetworkResponse<T>> {\n ThrottlingUtils.preProcess(this.cacheManager, thumbprint);\n\n let response;\n try {\n response = await this.networkClient.sendPostRequestAsync<T>(tokenEndpoint, options);\n } catch (e) {\n if (e instanceof AuthError) {\n throw e;\n } else {\n throw ClientAuthError.createNetworkError(tokenEndpoint, e);\n }\n }\n\n ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response);\n\n return response;\n }\n}\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;IACH,MAAM,CAAC,0BAA0B,CAAC,QAAQ,EAAE,eAAe,CAAC,gCAAgC,CAAC,GAAG,OAAO;IAOvG;;;OAGG;IACH,MAAM,CAAC,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAU1D,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC,EAAE,MAAM,GAAG,OAAO;CAWzJ"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*! @azure/msal-common v4.5.1 2021-08-02 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { ThrottlingConstants, CacheSchemaType, Constants, HeaderNames } from '../utils/Constants.js';
|
|
4
|
+
import { ServerError } from '../error/ServerError.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
+
* Licensed under the MIT License.
|
|
9
|
+
*/
|
|
10
|
+
var ThrottlingUtils = /** @class */ (function () {
|
|
11
|
+
function ThrottlingUtils() {
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Prepares a RequestThumbprint to be stored as a key.
|
|
15
|
+
* @param thumbprint
|
|
16
|
+
*/
|
|
17
|
+
ThrottlingUtils.generateThrottlingStorageKey = function (thumbprint) {
|
|
18
|
+
return ThrottlingConstants.THROTTLING_PREFIX + "." + JSON.stringify(thumbprint);
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Performs necessary throttling checks before a network request.
|
|
22
|
+
* @param cacheManager
|
|
23
|
+
* @param thumbprint
|
|
24
|
+
*/
|
|
25
|
+
ThrottlingUtils.preProcess = function (cacheManager, thumbprint) {
|
|
26
|
+
var _a;
|
|
27
|
+
var key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);
|
|
28
|
+
var value = cacheManager.getThrottlingCache(key);
|
|
29
|
+
if (value) {
|
|
30
|
+
if (value.throttleTime < Date.now()) {
|
|
31
|
+
cacheManager.removeItem(key, CacheSchemaType.THROTTLING);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
throw new ServerError(((_a = value.errorCodes) === null || _a === void 0 ? void 0 : _a.join(" ")) || Constants.EMPTY_STRING, value.errorMessage, value.subError);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Performs necessary throttling checks after a network request.
|
|
39
|
+
* @param cacheManager
|
|
40
|
+
* @param thumbprint
|
|
41
|
+
* @param response
|
|
42
|
+
*/
|
|
43
|
+
ThrottlingUtils.postProcess = function (cacheManager, thumbprint, response) {
|
|
44
|
+
if (ThrottlingUtils.checkResponseStatus(response) || ThrottlingUtils.checkResponseForRetryAfter(response)) {
|
|
45
|
+
var thumbprintValue = {
|
|
46
|
+
throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),
|
|
47
|
+
error: response.body.error,
|
|
48
|
+
errorCodes: response.body.error_codes,
|
|
49
|
+
errorMessage: response.body.error_description,
|
|
50
|
+
subError: response.body.suberror
|
|
51
|
+
};
|
|
52
|
+
cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Checks a NetworkResponse object's status codes against 429 or 5xx
|
|
57
|
+
* @param response
|
|
58
|
+
*/
|
|
59
|
+
ThrottlingUtils.checkResponseStatus = function (response) {
|
|
60
|
+
return response.status === 429 || response.status >= 500 && response.status < 600;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Checks a NetworkResponse object's RetryAfter header
|
|
64
|
+
* @param response
|
|
65
|
+
*/
|
|
66
|
+
ThrottlingUtils.checkResponseForRetryAfter = function (response) {
|
|
67
|
+
if (response.headers) {
|
|
68
|
+
return response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) && (response.status < 200 || response.status >= 300);
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.
|
|
74
|
+
* @param throttleTime
|
|
75
|
+
*/
|
|
76
|
+
ThrottlingUtils.calculateThrottleTime = function (throttleTime) {
|
|
77
|
+
var time = throttleTime <= 0 ? 0 : throttleTime;
|
|
78
|
+
var currentSeconds = Date.now() / 1000;
|
|
79
|
+
return Math.floor(Math.min(currentSeconds + (time || ThrottlingConstants.DEFAULT_THROTTLE_TIME_SECONDS), currentSeconds + ThrottlingConstants.DEFAULT_MAX_THROTTLE_TIME_SECONDS) * 1000);
|
|
80
|
+
};
|
|
81
|
+
ThrottlingUtils.removeThrottle = function (cacheManager, clientId, authority, scopes, homeAccountIdentifier) {
|
|
82
|
+
var thumbprint = {
|
|
83
|
+
clientId: clientId,
|
|
84
|
+
authority: authority,
|
|
85
|
+
scopes: scopes,
|
|
86
|
+
homeAccountIdentifier: homeAccountIdentifier
|
|
87
|
+
};
|
|
88
|
+
var key = this.generateThrottlingStorageKey(thumbprint);
|
|
89
|
+
return cacheManager.removeItem(key, CacheSchemaType.THROTTLING);
|
|
90
|
+
};
|
|
91
|
+
return ThrottlingUtils;
|
|
92
|
+
}());
|
|
93
|
+
|
|
94
|
+
export { ThrottlingUtils };
|
|
95
|
+
//# sourceMappingURL=ThrottlingUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThrottlingUtils.js","sources":["../../src/network/ThrottlingUtils.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { NetworkResponse } from \"./NetworkManager\";\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\nimport { HeaderNames, CacheSchemaType, ThrottlingConstants, Constants } from \"../utils/Constants\";\nimport { CacheManager } from \"../cache/CacheManager\";\nimport { ServerError } from \"../error/ServerError\";\nimport { RequestThumbprint } from \"./RequestThumbprint\";\nimport { ThrottlingEntity } from \"../cache/entities/ThrottlingEntity\";\n\nexport class ThrottlingUtils {\n\n /**\n * Prepares a RequestThumbprint to be stored as a key.\n * @param thumbprint\n */\n static generateThrottlingStorageKey(thumbprint: RequestThumbprint): string {\n return `${ThrottlingConstants.THROTTLING_PREFIX}.${JSON.stringify(thumbprint)}`;\n }\n\n /**\n * Performs necessary throttling checks before a network request.\n * @param cacheManager\n * @param thumbprint\n */\n static preProcess(cacheManager: CacheManager, thumbprint: RequestThumbprint): void {\n const key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);\n const value = cacheManager.getThrottlingCache(key);\n\n if (value) {\n if (value.throttleTime < Date.now()) {\n cacheManager.removeItem(key, CacheSchemaType.THROTTLING);\n return;\n }\n throw new ServerError(value.errorCodes?.join(\" \") || Constants.EMPTY_STRING, value.errorMessage, value.subError);\n }\n }\n\n /**\n * Performs necessary throttling checks after a network request.\n * @param cacheManager\n * @param thumbprint\n * @param response\n */\n static postProcess(cacheManager: CacheManager, thumbprint: RequestThumbprint, response: NetworkResponse<ServerAuthorizationTokenResponse>): void {\n if (ThrottlingUtils.checkResponseStatus(response) || ThrottlingUtils.checkResponseForRetryAfter(response)) {\n const thumbprintValue: ThrottlingEntity = {\n throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),\n error: response.body.error,\n errorCodes: response.body.error_codes,\n errorMessage: response.body.error_description,\n subError: response.body.suberror\n };\n cacheManager.setThrottlingCache(\n ThrottlingUtils.generateThrottlingStorageKey(thumbprint),\n thumbprintValue\n );\n }\n }\n\n /**\n * Checks a NetworkResponse object's status codes against 429 or 5xx\n * @param response\n */\n static checkResponseStatus(response: NetworkResponse<ServerAuthorizationTokenResponse>): boolean {\n return response.status === 429 || response.status >= 500 && response.status < 600;\n }\n\n /**\n * Checks a NetworkResponse object's RetryAfter header\n * @param response\n */\n static checkResponseForRetryAfter(response: NetworkResponse<ServerAuthorizationTokenResponse>): boolean {\n if (response.headers) {\n return response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) && (response.status < 200 || response.status >= 300);\n }\n return false;\n }\n\n /**\n * Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.\n * @param throttleTime\n */\n static calculateThrottleTime(throttleTime: number): number {\n const time = throttleTime <= 0 ? 0 : throttleTime;\n\n const currentSeconds = Date.now() / 1000;\n return Math.floor(Math.min(\n currentSeconds + (time || ThrottlingConstants.DEFAULT_THROTTLE_TIME_SECONDS),\n currentSeconds + ThrottlingConstants.DEFAULT_MAX_THROTTLE_TIME_SECONDS\n ) * 1000);\n }\n\n static removeThrottle(cacheManager: CacheManager, clientId: string, authority: string, scopes: Array<string>, homeAccountIdentifier?: string): boolean {\n const thumbprint: RequestThumbprint = {\n clientId,\n authority,\n scopes,\n homeAccountIdentifier\n };\n\n const key = this.generateThrottlingStorageKey(thumbprint);\n return cacheManager.removeItem(key, CacheSchemaType.THROTTLING);\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;IAaA;KA8FC;;;;;IAxFU,4CAA4B,GAAnC,UAAoC,UAA6B;QAC7D,OAAU,mBAAmB,CAAC,iBAAiB,SAAI,IAAI,CAAC,SAAS,CAAC,UAAU,CAAG,CAAC;KACnF;;;;;;IAOM,0BAAU,GAAjB,UAAkB,YAA0B,EAAE,UAA6B;;QACvE,IAAM,GAAG,GAAG,eAAe,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;QACrE,IAAM,KAAK,GAAG,YAAY,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAEnD,IAAI,KAAK,EAAE;YACP,IAAI,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE;gBACjC,YAAY,CAAC,UAAU,CAAC,GAAG,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;gBACzD,OAAO;aACV;YACD,MAAM,I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O,KAAK,CAAC;KAChB;;;;;IAMM,qCAAqB,GAA5B,UAA6B,YAAoB;QAC7C,IAAM,IAAI,GAAG,YAAY,IAAI,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC;QAElD,IAAM,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CACtB,cAAc,IAAI,IAAI,IAAI,mBAAmB,CAAC,6BAA6B,CAAC,EAC5E,cAAc,GAAG,mBAAmB,CAAC,iCAAiC,CACzE,GAAG,IAAI,CAAC,CAAC;KACb;IAEM,8BAAc,GAArB,UAAsB,YAA0B,EAAE,QAAgB,EAAE,SAAiB,EAAE,MAAqB,EAAE,qBAA8B;QACxI,IAAM,UAAU,GAAsB;YAClC,QAAQ,UAAA;YACR,SAAS,WAAA;YACT,MAAM,QAAA;YACN,qBAAqB,uBAAA;SACxB,CAAC;QAEF,IAAM,GAAG,GAAG,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;QAC1D,OAAO,YAAY,CAAC,UAAU,CAAC,GAAG,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;KACnE;IACL,sBAAC;AAAD,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageMetadata.js","sources":["../src/packageMetadata.ts"],"sourcesContent":["/* eslint-disable header/header */\nexport const name = \"@azure/msal-common\";\nexport const version = \"4.5.1\";\n"],"names":[],"mappings":";;AAAA;IACa,IAAI,GAAG,qBAAqB;IAC5B,OAAO,GAAG;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseAuthRequest } from "./BaseAuthRequest";
|
|
2
2
|
import { StringDict } from "../utils/MsalTypes";
|
|
3
|
+
import { CcsCredential } from "../account/CcsCredential";
|
|
3
4
|
/**
|
|
4
5
|
* Request object passed by user to acquire a token from the server exchanging a valid authorization code (second leg of OAuth2.0 Authorization Code flow)
|
|
5
6
|
*
|
|
@@ -18,5 +19,7 @@ export declare type CommonAuthorizationCodeRequest = BaseAuthRequest & {
|
|
|
18
19
|
redirectUri: string;
|
|
19
20
|
codeVerifier?: string;
|
|
20
21
|
tokenQueryParameters?: StringDict;
|
|
22
|
+
clientInfo?: string;
|
|
23
|
+
ccsCredential?: CcsCredential;
|
|
21
24
|
};
|
|
22
25
|
//# sourceMappingURL=CommonAuthorizationCodeRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonAuthorizationCodeRequest.d.ts","sourceRoot":"","sources":["../../src/request/CommonAuthorizationCodeRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"CommonAuthorizationCodeRequest.d.ts","sourceRoot":"","sources":["../../src/request/CommonAuthorizationCodeRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,oBAAY,8BAA8B,GAAG,eAAe,GAAG;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,aAAa,CAAC;CACjC,CAAC"}
|
|
@@ -20,6 +20,7 @@ import { AccountInfo } from "../account/AccountInfo";
|
|
|
20
20
|
* none: will ensure that the user isn't presented with any interactive prompt. if request can't be completed via single-sign on, the endpoint will return an interaction_required error
|
|
21
21
|
* consent: will the trigger the OAuth consent dialog after the user signs in, asking the user to grant permissions to the app
|
|
22
22
|
* select_account: will interrupt single sign-=on providing account selection experience listing all the accounts in session or any remembered accounts or an option to choose to use a different account
|
|
23
|
+
* create: will direct the user to the account creation experience instead of the log in experience
|
|
23
24
|
* - account - AccountInfo obtained from a getAccount API. Will be used in certain scenarios to generate login_hint if both loginHint and sid params are not provided.
|
|
24
25
|
* - loginHint - Can be used to pre-fill the username/email address field of the sign-in page for the user, if you know the username/email address ahead of time. Often apps use this parameter during re-authentication, having already extracted the username from a previous sign-in using the preferred_username claim.
|
|
25
26
|
* - sid - Session ID, unique identifier for the session. Available as an optional claim on ID tokens.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonAuthorizationUrlRequest.d.ts","sourceRoot":"","sources":["../../src/request/CommonAuthorizationUrlRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"CommonAuthorizationUrlRequest.d.ts","sourceRoot":"","sources":["../../src/request/CommonAuthorizationUrlRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,oBAAY,6BAA6B,GAAG,eAAe,GAAG;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { BaseAuthRequest } from "./BaseAuthRequest";
|
|
2
|
+
import { AzureRegion } from "../authority/AzureRegion";
|
|
2
3
|
/**
|
|
3
4
|
* CommonClientCredentialRequest
|
|
4
|
-
* - scopes
|
|
5
|
-
* - authority
|
|
6
|
-
* - correlationId
|
|
7
|
-
* - skipCache
|
|
5
|
+
* - scopes - Array of scopes the application is requesting access to.
|
|
6
|
+
* - authority - URL of the authority, the security token service (STS) from which MSAL will acquire tokens.
|
|
7
|
+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
8
|
+
* - skipCache - Skip token cache lookup and force request to authority to get a a new token. Defaults to false.
|
|
9
|
+
* - preferredAzureRegionOptions - Options of the user's preferred azure region
|
|
8
10
|
*/
|
|
9
11
|
export declare type CommonClientCredentialRequest = BaseAuthRequest & {
|
|
10
12
|
skipCache?: boolean;
|
|
13
|
+
azureRegion?: AzureRegion;
|
|
11
14
|
};
|
|
12
15
|
//# sourceMappingURL=CommonClientCredentialRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonClientCredentialRequest.d.ts","sourceRoot":"","sources":["../../src/request/CommonClientCredentialRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"CommonClientCredentialRequest.d.ts","sourceRoot":"","sources":["../../src/request/CommonClientCredentialRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;;;;;GAOG;AACH,oBAAY,6BAA6B,GAAG,eAAe,GAAG;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC7B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseAuthRequest } from "./BaseAuthRequest";
|
|
2
2
|
import { StringDict } from "../utils/MsalTypes";
|
|
3
|
+
import { CcsCredential } from "../account/CcsCredential";
|
|
3
4
|
/**
|
|
4
5
|
* CommonRefreshTokenRequest
|
|
5
6
|
* - scopes - Array of scopes the application is requesting access to.
|
|
@@ -13,5 +14,6 @@ import { StringDict } from "../utils/MsalTypes";
|
|
|
13
14
|
export declare type CommonRefreshTokenRequest = BaseAuthRequest & {
|
|
14
15
|
refreshToken: string;
|
|
15
16
|
tokenQueryParameters?: StringDict;
|
|
17
|
+
ccsCredential?: CcsCredential;
|
|
16
18
|
};
|
|
17
19
|
//# sourceMappingURL=CommonRefreshTokenRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonRefreshTokenRequest.d.ts","sourceRoot":"","sources":["../../src/request/CommonRefreshTokenRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"CommonRefreshTokenRequest.d.ts","sourceRoot":"","sources":["../../src/request/CommonRefreshTokenRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;;;;;;;;GASG;AACH,oBAAY,yBAAyB,GAAG,eAAe,GAAG;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,aAAa,CAAC,EAAE,aAAa,CAAC;CACjC,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { ResponseMode } from "../utils/Constants";
|
|
|
2
2
|
import { StringDict } from "../utils/MsalTypes";
|
|
3
3
|
import { LibraryInfo } from "../config/ClientConfiguration";
|
|
4
4
|
import { ServerTelemetryManager } from "../telemetry/server/ServerTelemetryManager";
|
|
5
|
+
import { ClientInfo } from "../account/ClientInfo";
|
|
5
6
|
export declare class RequestParameterBuilder {
|
|
6
7
|
private parameters;
|
|
7
8
|
constructor();
|
|
@@ -50,6 +51,16 @@ export declare class RequestParameterBuilder {
|
|
|
50
51
|
* @param loginHint
|
|
51
52
|
*/
|
|
52
53
|
addLoginHint(loginHint: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Adds the CCS (Cache Credential Service) query parameter for login_hint
|
|
56
|
+
* @param loginHint
|
|
57
|
+
*/
|
|
58
|
+
addCcsUpn(loginHint: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Adds the CCS (Cache Credential Service) query parameter for account object
|
|
61
|
+
* @param loginHint
|
|
62
|
+
*/
|
|
63
|
+
addCcsOid(clientInfo: ClientInfo): void;
|
|
53
64
|
/**
|
|
54
65
|
* add sid
|
|
55
66
|
* @param sid
|