@azure/msal-node 1.0.0-beta.2 → 1.0.0-beta.6
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 +144 -0
- package/README.md +1 -1
- package/changelog.md +43 -1
- package/dist/cache/ITokenCache.d.ts +16 -0
- package/dist/cache/ITokenCache.d.ts.map +1 -0
- package/dist/cache/{Storage.d.ts → NodeStorage.d.ts} +55 -31
- package/dist/cache/NodeStorage.d.ts.map +1 -0
- package/dist/cache/TokenCache.d.ts +30 -13
- package/dist/cache/TokenCache.d.ts.map +1 -0
- package/dist/cache/serializer/Deserializer.d.ts +1 -0
- package/dist/cache/serializer/Deserializer.d.ts.map +1 -0
- package/dist/cache/serializer/Serializer.d.ts +1 -0
- package/dist/cache/serializer/Serializer.d.ts.map +1 -0
- package/dist/cache/serializer/SerializerTypes.d.ts +33 -0
- package/dist/cache/serializer/SerializerTypes.d.ts.map +1 -0
- package/dist/client/ClientApplication.d.ts +36 -7
- package/dist/client/ClientApplication.d.ts.map +1 -0
- package/dist/client/ClientAssertion.d.ts +25 -1
- package/dist/client/ClientAssertion.d.ts.map +1 -0
- package/dist/client/ConfidentialClientApplication.d.ts +11 -5
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -0
- package/dist/client/IConfidentialClientApplication.d.ts +33 -0
- package/dist/client/IConfidentialClientApplication.d.ts.map +1 -0
- package/dist/client/IPublicClientApplication.d.ts +33 -0
- package/dist/client/IPublicClientApplication.d.ts.map +1 -0
- package/dist/client/PublicClientApplication.d.ts +8 -5
- package/dist/client/PublicClientApplication.d.ts.map +1 -0
- package/dist/config/Configuration.d.ts +10 -3
- package/dist/config/Configuration.d.ts.map +1 -0
- package/dist/crypto/CryptoProvider.d.ts +10 -2
- package/dist/crypto/CryptoProvider.d.ts.map +1 -0
- package/dist/crypto/GuidGenerator.d.ts +1 -0
- package/dist/crypto/GuidGenerator.d.ts.map +1 -0
- package/dist/crypto/PkceGenerator.d.ts +1 -0
- package/dist/crypto/PkceGenerator.d.ts.map +1 -0
- package/dist/index.d.ts +15 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/msal-node.cjs.development.js +274 -205
- package/dist/msal-node.cjs.development.js.map +1 -1
- package/dist/msal-node.cjs.production.min.js +1 -1
- package/dist/msal-node.cjs.production.min.js.map +1 -1
- package/dist/msal-node.esm.js +273 -204
- package/dist/msal-node.esm.js.map +1 -1
- package/dist/network/HttpClient.d.ts +1 -1
- package/dist/network/HttpClient.d.ts.map +1 -0
- package/dist/packageMetadata.d.ts +3 -0
- package/dist/packageMetadata.d.ts.map +1 -0
- package/dist/request/AuthorizationCodeRequest.d.ts +3 -1
- package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -0
- package/dist/request/AuthorizationUrlRequest.d.ts +3 -1
- package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -0
- package/dist/request/ClientCredentialRequest.d.ts +3 -1
- package/dist/request/ClientCredentialRequest.d.ts.map +1 -0
- package/dist/request/DeviceCodeRequest.d.ts +3 -1
- package/dist/request/DeviceCodeRequest.d.ts.map +1 -0
- package/dist/request/OnBehalfOfRequest.d.ts +3 -1
- package/dist/request/OnBehalfOfRequest.d.ts.map +1 -0
- package/dist/request/RefreshTokenRequest.d.ts +3 -1
- package/dist/request/RefreshTokenRequest.d.ts.map +1 -0
- package/dist/request/SilentFlowRequest.d.ts +3 -1
- package/dist/request/SilentFlowRequest.d.ts.map +1 -0
- package/dist/request/UsernamePasswordRequest.d.ts +3 -1
- package/dist/request/UsernamePasswordRequest.d.ts.map +1 -0
- package/dist/utils/Constants.d.ts +1 -0
- package/dist/utils/Constants.d.ts.map +1 -0
- package/dist/utils/EncodingUtils.d.ts +1 -0
- package/dist/utils/EncodingUtils.d.ts.map +1 -0
- package/dist/utils/NetworkUtils.d.ts +1 -0
- package/dist/utils/NetworkUtils.d.ts.map +1 -0
- package/package.json +8 -12
package/dist/msal-node.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Constants as Constants$1, ProtocolMode, LogLevel, StringUtils, AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, ThrottlingEntity, TokenCacheContext, ServerTelemetryManager, Logger,
|
|
1
|
+
import { Constants as Constants$1, ProtocolMode, LogLevel, StringUtils, AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, ThrottlingEntity, TokenCacheContext, OIDC_DEFAULT_SCOPES, ServerTelemetryManager, Logger, AuthorizationCodeClient, ResponseMode, AuthenticationScheme, RefreshTokenClient, SilentFlowClient, AuthorityFactory, DeviceCodeClient, UsernamePasswordClient, ClientAuthError, TimeUtils, ClientCredentialClient, OnBehalfOfClient } from '@azure/msal-common';
|
|
2
2
|
export { AuthError, AuthErrorMessage, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, LogLevel, Logger, PromptValue, ProtocolMode, ResponseMode, ServerError, TokenCacheContext } from '@azure/msal-common';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import { v4 } from 'uuid';
|
|
@@ -41,22 +41,6 @@ function _asyncToGenerator(fn) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function _defineProperties(target, props) {
|
|
45
|
-
for (var i = 0; i < props.length; i++) {
|
|
46
|
-
var descriptor = props[i];
|
|
47
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
48
|
-
descriptor.configurable = true;
|
|
49
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
50
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
55
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
56
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
57
|
-
return Constructor;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
44
|
function _extends() {
|
|
61
45
|
_extends = Object.assign || function (target) {
|
|
62
46
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -918,20 +902,15 @@ var JwtConstants = {
|
|
|
918
902
|
*/
|
|
919
903
|
|
|
920
904
|
var HttpClient = /*#__PURE__*/function () {
|
|
921
|
-
function HttpClient() {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
}
|
|
905
|
+
function HttpClient() {}
|
|
906
|
+
|
|
907
|
+
var _proto = HttpClient.prototype;
|
|
908
|
+
|
|
926
909
|
/**
|
|
927
910
|
* Http Get request
|
|
928
911
|
* @param url
|
|
929
912
|
* @param options
|
|
930
913
|
*/
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
var _proto = HttpClient.prototype;
|
|
934
|
-
|
|
935
914
|
_proto.sendGetRequestAsync =
|
|
936
915
|
/*#__PURE__*/
|
|
937
916
|
function () {
|
|
@@ -944,7 +923,10 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
944
923
|
request = {
|
|
945
924
|
method: HttpMethod.GET,
|
|
946
925
|
url: url,
|
|
947
|
-
headers: options && options.headers
|
|
926
|
+
headers: options && options.headers,
|
|
927
|
+
validateStatus: function validateStatus() {
|
|
928
|
+
return true;
|
|
929
|
+
}
|
|
948
930
|
};
|
|
949
931
|
_context.next = 3;
|
|
950
932
|
return axios(request);
|
|
@@ -991,7 +973,10 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
991
973
|
method: HttpMethod.POST,
|
|
992
974
|
url: url,
|
|
993
975
|
data: options && options.body || "",
|
|
994
|
-
headers: options && options.headers
|
|
976
|
+
headers: options && options.headers,
|
|
977
|
+
validateStatus: function validateStatus() {
|
|
978
|
+
return true;
|
|
979
|
+
}
|
|
995
980
|
};
|
|
996
981
|
_context2.next = 3;
|
|
997
982
|
return axios(request);
|
|
@@ -1051,6 +1036,7 @@ var DEFAULT_AUTH_OPTIONS = {
|
|
|
1051
1036
|
},
|
|
1052
1037
|
knownAuthorities: [],
|
|
1053
1038
|
cloudDiscoveryMetadata: "",
|
|
1039
|
+
authorityMetadata: "",
|
|
1054
1040
|
clientCapabilities: [],
|
|
1055
1041
|
protocolMode: ProtocolMode.AAD
|
|
1056
1042
|
};
|
|
@@ -1068,11 +1054,12 @@ var DEFAULT_SYSTEM_OPTIONS = {
|
|
|
1068
1054
|
/**
|
|
1069
1055
|
* Sets the default options when not explicitly configured from app developer
|
|
1070
1056
|
*
|
|
1071
|
-
* @param auth
|
|
1072
|
-
* @param cache
|
|
1073
|
-
* @param system
|
|
1057
|
+
* @param auth - Authentication options
|
|
1058
|
+
* @param cache - Cache options
|
|
1059
|
+
* @param system - System options
|
|
1074
1060
|
*
|
|
1075
1061
|
* @returns Configuration
|
|
1062
|
+
* @public
|
|
1076
1063
|
*/
|
|
1077
1064
|
|
|
1078
1065
|
function buildAppConfiguration(_ref) {
|
|
@@ -1229,7 +1216,7 @@ var PkceGenerator = /*#__PURE__*/function () {
|
|
|
1229
1216
|
;
|
|
1230
1217
|
|
|
1231
1218
|
_proto.generateCodeChallengeFromVerifier = function generateCodeChallengeFromVerifier(codeVerifier) {
|
|
1232
|
-
return EncodingUtils.base64EncodeUrl(this.sha256(codeVerifier).toString("
|
|
1219
|
+
return EncodingUtils.base64EncodeUrl(this.sha256(codeVerifier).toString("base64"), "base64");
|
|
1233
1220
|
}
|
|
1234
1221
|
/**
|
|
1235
1222
|
* generate 'SHA256' hash
|
|
@@ -1267,6 +1254,7 @@ var PkceGenerator = /*#__PURE__*/function () {
|
|
|
1267
1254
|
/**
|
|
1268
1255
|
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
1269
1256
|
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
1257
|
+
* @public
|
|
1270
1258
|
*/
|
|
1271
1259
|
|
|
1272
1260
|
var CryptoProvider = /*#__PURE__*/function () {
|
|
@@ -1287,7 +1275,7 @@ var CryptoProvider = /*#__PURE__*/function () {
|
|
|
1287
1275
|
}
|
|
1288
1276
|
/**
|
|
1289
1277
|
* Encodes input string to base64.
|
|
1290
|
-
* @param input
|
|
1278
|
+
* @param input - string to be encoded
|
|
1291
1279
|
*/
|
|
1292
1280
|
;
|
|
1293
1281
|
|
|
@@ -1296,7 +1284,7 @@ var CryptoProvider = /*#__PURE__*/function () {
|
|
|
1296
1284
|
}
|
|
1297
1285
|
/**
|
|
1298
1286
|
* Decodes input string from base64.
|
|
1299
|
-
* @param input
|
|
1287
|
+
* @param input - string to be decoded
|
|
1300
1288
|
*/
|
|
1301
1289
|
;
|
|
1302
1290
|
|
|
@@ -1310,11 +1298,19 @@ var CryptoProvider = /*#__PURE__*/function () {
|
|
|
1310
1298
|
|
|
1311
1299
|
_proto.generatePkceCodes = function generatePkceCodes() {
|
|
1312
1300
|
return this.pkceGenerator.generatePkceCodes();
|
|
1313
|
-
}
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
1304
|
+
*/
|
|
1305
|
+
;
|
|
1314
1306
|
|
|
1315
1307
|
_proto.getPublicKeyThumbprint = function getPublicKeyThumbprint() {
|
|
1316
1308
|
throw new Error("Method not implemented.");
|
|
1317
|
-
}
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
|
|
1312
|
+
*/
|
|
1313
|
+
;
|
|
1318
1314
|
|
|
1319
1315
|
_proto.signJwt = function signJwt() {
|
|
1320
1316
|
throw new Error("Method not implemented.");
|
|
@@ -1661,12 +1657,13 @@ var Serializer = /*#__PURE__*/function () {
|
|
|
1661
1657
|
|
|
1662
1658
|
/**
|
|
1663
1659
|
* This class implements Storage for node, reading cache from user specified storage location or an extension library
|
|
1660
|
+
* @public
|
|
1664
1661
|
*/
|
|
1665
1662
|
|
|
1666
|
-
var
|
|
1667
|
-
_inheritsLoose(
|
|
1663
|
+
var NodeStorage = /*#__PURE__*/function (_CacheManager) {
|
|
1664
|
+
_inheritsLoose(NodeStorage, _CacheManager);
|
|
1668
1665
|
|
|
1669
|
-
function
|
|
1666
|
+
function NodeStorage(logger, clientId, cryptoImpl) {
|
|
1670
1667
|
var _this;
|
|
1671
1668
|
|
|
1672
1669
|
_this = _CacheManager.call(this, clientId, cryptoImpl) || this;
|
|
@@ -1675,12 +1672,21 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1675
1672
|
_this.logger = logger;
|
|
1676
1673
|
return _this;
|
|
1677
1674
|
}
|
|
1675
|
+
/**
|
|
1676
|
+
* Queue up callbacks
|
|
1677
|
+
* @param func - a callback function for cache change indication
|
|
1678
|
+
*/
|
|
1679
|
+
|
|
1678
1680
|
|
|
1679
|
-
var _proto =
|
|
1681
|
+
var _proto = NodeStorage.prototype;
|
|
1680
1682
|
|
|
1681
1683
|
_proto.registerChangeEmitter = function registerChangeEmitter(func) {
|
|
1682
1684
|
this.changeEmitters.push(func);
|
|
1683
|
-
}
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Invoke the callback when cache changes
|
|
1688
|
+
*/
|
|
1689
|
+
;
|
|
1684
1690
|
|
|
1685
1691
|
_proto.emitChange = function emitChange() {
|
|
1686
1692
|
this.changeEmitters.forEach(function (func) {
|
|
@@ -1689,7 +1695,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1689
1695
|
}
|
|
1690
1696
|
/**
|
|
1691
1697
|
* Converts cacheKVStore to InMemoryCache
|
|
1692
|
-
* @param cache
|
|
1698
|
+
* @param cache - key value store
|
|
1693
1699
|
*/
|
|
1694
1700
|
;
|
|
1695
1701
|
|
|
@@ -1722,7 +1728,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1722
1728
|
}
|
|
1723
1729
|
/**
|
|
1724
1730
|
* converts inMemoryCache to CacheKVStore
|
|
1725
|
-
* @param inMemoryCache
|
|
1731
|
+
* @param inMemoryCache - kvstore map for inmemory
|
|
1726
1732
|
*/
|
|
1727
1733
|
;
|
|
1728
1734
|
|
|
@@ -1745,7 +1751,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1745
1751
|
}
|
|
1746
1752
|
/**
|
|
1747
1753
|
* sets the current in memory cache for the client
|
|
1748
|
-
* @param inMemoryCache
|
|
1754
|
+
* @param inMemoryCache - key value map in memory
|
|
1749
1755
|
*/
|
|
1750
1756
|
;
|
|
1751
1757
|
|
|
@@ -1767,7 +1773,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1767
1773
|
}
|
|
1768
1774
|
/**
|
|
1769
1775
|
* sets the current cache (key value store)
|
|
1770
|
-
* @param cacheMap
|
|
1776
|
+
* @param cacheMap - key value map
|
|
1771
1777
|
*/
|
|
1772
1778
|
;
|
|
1773
1779
|
|
|
@@ -1779,7 +1785,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1779
1785
|
}
|
|
1780
1786
|
/**
|
|
1781
1787
|
* Gets cache item with given key.
|
|
1782
|
-
* @param key
|
|
1788
|
+
* @param key - lookup key for the cache entry
|
|
1783
1789
|
*/
|
|
1784
1790
|
;
|
|
1785
1791
|
|
|
@@ -1790,9 +1796,9 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1790
1796
|
return cache[key];
|
|
1791
1797
|
}
|
|
1792
1798
|
/**
|
|
1793
|
-
* Gets cache item with given
|
|
1794
|
-
* @param key
|
|
1795
|
-
* @param value
|
|
1799
|
+
* Gets cache item with given key-value
|
|
1800
|
+
* @param key - lookup key for the cache entry
|
|
1801
|
+
* @param value - value of the cache entry
|
|
1796
1802
|
*/
|
|
1797
1803
|
;
|
|
1798
1804
|
|
|
@@ -1806,7 +1812,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1806
1812
|
}
|
|
1807
1813
|
/**
|
|
1808
1814
|
* fetch the account entity
|
|
1809
|
-
* @param accountKey
|
|
1815
|
+
* @param accountKey - lookup key to fetch cache type AccountEntity
|
|
1810
1816
|
*/
|
|
1811
1817
|
;
|
|
1812
1818
|
|
|
@@ -1821,7 +1827,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1821
1827
|
}
|
|
1822
1828
|
/**
|
|
1823
1829
|
* set account entity
|
|
1824
|
-
* @param account
|
|
1830
|
+
* @param account - cache value to be set of type AccountEntity
|
|
1825
1831
|
*/
|
|
1826
1832
|
;
|
|
1827
1833
|
|
|
@@ -1831,7 +1837,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1831
1837
|
}
|
|
1832
1838
|
/**
|
|
1833
1839
|
* fetch the idToken credential
|
|
1834
|
-
* @param idTokenKey
|
|
1840
|
+
* @param idTokenKey - lookup key to fetch cache type IdTokenEntity
|
|
1835
1841
|
*/
|
|
1836
1842
|
;
|
|
1837
1843
|
|
|
@@ -1846,7 +1852,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1846
1852
|
}
|
|
1847
1853
|
/**
|
|
1848
1854
|
* set idToken credential
|
|
1849
|
-
* @param idToken
|
|
1855
|
+
* @param idToken - cache value to be set of type IdTokenEntity
|
|
1850
1856
|
*/
|
|
1851
1857
|
;
|
|
1852
1858
|
|
|
@@ -1856,7 +1862,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1856
1862
|
}
|
|
1857
1863
|
/**
|
|
1858
1864
|
* fetch the accessToken credential
|
|
1859
|
-
* @param accessTokenKey
|
|
1865
|
+
* @param accessTokenKey - lookup key to fetch cache type AccessTokenEntity
|
|
1860
1866
|
*/
|
|
1861
1867
|
;
|
|
1862
1868
|
|
|
@@ -1871,7 +1877,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1871
1877
|
}
|
|
1872
1878
|
/**
|
|
1873
1879
|
* set accessToken credential
|
|
1874
|
-
* @param accessToken
|
|
1880
|
+
* @param accessToken - cache value to be set of type AccessTokenEntity
|
|
1875
1881
|
*/
|
|
1876
1882
|
;
|
|
1877
1883
|
|
|
@@ -1881,7 +1887,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1881
1887
|
}
|
|
1882
1888
|
/**
|
|
1883
1889
|
* fetch the refreshToken credential
|
|
1884
|
-
* @param refreshTokenKey
|
|
1890
|
+
* @param refreshTokenKey - lookup key to fetch cache type RefreshTokenEntity
|
|
1885
1891
|
*/
|
|
1886
1892
|
;
|
|
1887
1893
|
|
|
@@ -1896,7 +1902,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1896
1902
|
}
|
|
1897
1903
|
/**
|
|
1898
1904
|
* set refreshToken credential
|
|
1899
|
-
* @param refreshToken
|
|
1905
|
+
* @param refreshToken - cache value to be set of type RefreshTokenEntity
|
|
1900
1906
|
*/
|
|
1901
1907
|
;
|
|
1902
1908
|
|
|
@@ -1906,7 +1912,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1906
1912
|
}
|
|
1907
1913
|
/**
|
|
1908
1914
|
* fetch appMetadata entity from the platform cache
|
|
1909
|
-
* @param appMetadataKey
|
|
1915
|
+
* @param appMetadataKey - lookup key to fetch cache type AppMetadataEntity
|
|
1910
1916
|
*/
|
|
1911
1917
|
;
|
|
1912
1918
|
|
|
@@ -1921,7 +1927,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1921
1927
|
}
|
|
1922
1928
|
/**
|
|
1923
1929
|
* set appMetadata entity to the platform cache
|
|
1924
|
-
* @param appMetadata
|
|
1930
|
+
* @param appMetadata - cache value to be set of type AppMetadataEntity
|
|
1925
1931
|
*/
|
|
1926
1932
|
;
|
|
1927
1933
|
|
|
@@ -1931,7 +1937,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1931
1937
|
}
|
|
1932
1938
|
/**
|
|
1933
1939
|
* fetch server telemetry entity from the platform cache
|
|
1934
|
-
* @param serverTelemetrykey
|
|
1940
|
+
* @param serverTelemetrykey - lookup key to fetch cache type ServerTelemetryEntity
|
|
1935
1941
|
*/
|
|
1936
1942
|
;
|
|
1937
1943
|
|
|
@@ -1946,17 +1952,54 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1946
1952
|
}
|
|
1947
1953
|
/**
|
|
1948
1954
|
* set server telemetry entity to the platform cache
|
|
1949
|
-
* @param serverTelemetryKey
|
|
1950
|
-
* @param serverTelemetry
|
|
1955
|
+
* @param serverTelemetryKey - lookup key to fetch cache type ServerTelemetryEntity
|
|
1956
|
+
* @param serverTelemetry - cache value to be set of type ServerTelemetryEntity
|
|
1951
1957
|
*/
|
|
1952
1958
|
;
|
|
1953
1959
|
|
|
1954
1960
|
_proto.setServerTelemetry = function setServerTelemetry(serverTelemetryKey, serverTelemetry) {
|
|
1955
1961
|
this.setItem(serverTelemetryKey, serverTelemetry);
|
|
1956
1962
|
}
|
|
1963
|
+
/**
|
|
1964
|
+
* fetch authority metadata entity from the platform cache
|
|
1965
|
+
* @param key - lookup key to fetch cache type AuthorityMetadataEntity
|
|
1966
|
+
*/
|
|
1967
|
+
;
|
|
1968
|
+
|
|
1969
|
+
_proto.getAuthorityMetadata = function getAuthorityMetadata(key) {
|
|
1970
|
+
var authorityMetadataEntity = this.getItem(key);
|
|
1971
|
+
|
|
1972
|
+
if (authorityMetadataEntity && AuthorityMetadataEntity.isAuthorityMetadataEntity(key, authorityMetadataEntity)) {
|
|
1973
|
+
return authorityMetadataEntity;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
return null;
|
|
1977
|
+
}
|
|
1978
|
+
/**
|
|
1979
|
+
* Get all authority metadata keys
|
|
1980
|
+
*/
|
|
1981
|
+
;
|
|
1982
|
+
|
|
1983
|
+
_proto.getAuthorityMetadataKeys = function getAuthorityMetadataKeys() {
|
|
1984
|
+
var _this2 = this;
|
|
1985
|
+
|
|
1986
|
+
return this.getKeys().filter(function (key) {
|
|
1987
|
+
return _this2.isAuthorityMetadata(key);
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* set authority metadata entity to the platform cache
|
|
1992
|
+
* @param key - lookup key to fetch cache type AuthorityMetadataEntity
|
|
1993
|
+
* @param metadata - cache value to be set of type AuthorityMetadataEntity
|
|
1994
|
+
*/
|
|
1995
|
+
;
|
|
1996
|
+
|
|
1997
|
+
_proto.setAuthorityMetadata = function setAuthorityMetadata(key, metadata) {
|
|
1998
|
+
this.setItem(key, metadata);
|
|
1999
|
+
}
|
|
1957
2000
|
/**
|
|
1958
2001
|
* fetch throttling entity from the platform cache
|
|
1959
|
-
* @param throttlingCacheKey
|
|
2002
|
+
* @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
|
|
1960
2003
|
*/
|
|
1961
2004
|
;
|
|
1962
2005
|
|
|
@@ -1971,8 +2014,8 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1971
2014
|
}
|
|
1972
2015
|
/**
|
|
1973
2016
|
* set throttling entity to the platform cache
|
|
1974
|
-
* @param throttlingCacheKey
|
|
1975
|
-
* @param throttlingCache
|
|
2017
|
+
* @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
|
|
2018
|
+
* @param throttlingCache - cache value to be set of type ThrottlingEntity
|
|
1976
2019
|
*/
|
|
1977
2020
|
;
|
|
1978
2021
|
|
|
@@ -1981,8 +2024,8 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
1981
2024
|
}
|
|
1982
2025
|
/**
|
|
1983
2026
|
* Removes the cache item from memory with the given key.
|
|
1984
|
-
* @param key
|
|
1985
|
-
* @param inMemory
|
|
2027
|
+
* @param key - lookup key to remove a cache entity
|
|
2028
|
+
* @param inMemory - key value map of the cache
|
|
1986
2029
|
*/
|
|
1987
2030
|
;
|
|
1988
2031
|
|
|
@@ -2007,7 +2050,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
2007
2050
|
}
|
|
2008
2051
|
/**
|
|
2009
2052
|
* Checks whether key is in cache.
|
|
2010
|
-
* @param key
|
|
2053
|
+
* @param key - look up key for a cache entity
|
|
2011
2054
|
*/
|
|
2012
2055
|
;
|
|
2013
2056
|
|
|
@@ -2031,37 +2074,37 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
|
2031
2074
|
;
|
|
2032
2075
|
|
|
2033
2076
|
_proto.clear = function clear() {
|
|
2034
|
-
var
|
|
2077
|
+
var _this3 = this;
|
|
2035
2078
|
|
|
2036
2079
|
this.logger.verbose("Clearing cache entries created by MSAL"); // read inMemoryCache
|
|
2037
2080
|
|
|
2038
2081
|
var cacheKeys = this.getKeys(); // delete each element
|
|
2039
2082
|
|
|
2040
2083
|
cacheKeys.forEach(function (key) {
|
|
2041
|
-
|
|
2084
|
+
_this3.removeItem(key);
|
|
2042
2085
|
});
|
|
2043
2086
|
this.emitChange();
|
|
2044
2087
|
}
|
|
2045
2088
|
/**
|
|
2046
2089
|
* Initialize in memory cache from an exisiting cache vault
|
|
2047
|
-
* @param cache
|
|
2090
|
+
* @param cache - blob formatted cache (JSON)
|
|
2048
2091
|
*/
|
|
2049
2092
|
;
|
|
2050
2093
|
|
|
2051
|
-
|
|
2094
|
+
NodeStorage.generateInMemoryCache = function generateInMemoryCache(cache) {
|
|
2052
2095
|
return Deserializer.deserializeAllCache(Deserializer.deserializeJSONBlob(cache));
|
|
2053
2096
|
}
|
|
2054
2097
|
/**
|
|
2055
2098
|
* retrieves the final JSON
|
|
2056
|
-
* @param inMemoryCache
|
|
2099
|
+
* @param inMemoryCache - itemised cache read from the JSON
|
|
2057
2100
|
*/
|
|
2058
2101
|
;
|
|
2059
2102
|
|
|
2060
|
-
|
|
2103
|
+
NodeStorage.generateJsonCache = function generateJsonCache(inMemoryCache) {
|
|
2061
2104
|
return Serializer.serializeAllCache(inMemoryCache);
|
|
2062
2105
|
};
|
|
2063
2106
|
|
|
2064
|
-
return
|
|
2107
|
+
return NodeStorage;
|
|
2065
2108
|
}(CacheManager);
|
|
2066
2109
|
|
|
2067
2110
|
var defaultSerializedCache = {
|
|
@@ -2073,6 +2116,7 @@ var defaultSerializedCache = {
|
|
|
2073
2116
|
};
|
|
2074
2117
|
/**
|
|
2075
2118
|
* In-memory token cache manager
|
|
2119
|
+
* @public
|
|
2076
2120
|
*/
|
|
2077
2121
|
|
|
2078
2122
|
var TokenCache = /*#__PURE__*/function () {
|
|
@@ -2118,7 +2162,7 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2118
2162
|
}
|
|
2119
2163
|
/**
|
|
2120
2164
|
* Deserializes JSON to in-memory cache. JSON should be in MSAL cache schema format
|
|
2121
|
-
* @param cache
|
|
2165
|
+
* @param cache - blob formatted cache
|
|
2122
2166
|
*/
|
|
2123
2167
|
;
|
|
2124
2168
|
|
|
@@ -2134,6 +2178,14 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2134
2178
|
this.logger.verbose("No cache snapshot to deserialize");
|
|
2135
2179
|
}
|
|
2136
2180
|
}
|
|
2181
|
+
/**
|
|
2182
|
+
* Fetches the cache key-value map
|
|
2183
|
+
*/
|
|
2184
|
+
;
|
|
2185
|
+
|
|
2186
|
+
_proto.getKVStore = function getKVStore() {
|
|
2187
|
+
return this.storage.getCache();
|
|
2188
|
+
}
|
|
2137
2189
|
/**
|
|
2138
2190
|
* API that retrieves all accounts currently in cache to the user
|
|
2139
2191
|
*/
|
|
@@ -2195,7 +2247,7 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2195
2247
|
* Returns the signed in account matching homeAccountId.
|
|
2196
2248
|
* (the account object is created at the time of successful login)
|
|
2197
2249
|
* or null when no matching account is found
|
|
2198
|
-
* @
|
|
2250
|
+
* @param homeAccountId - unique identifier for an account (uid.utid)
|
|
2199
2251
|
*/
|
|
2200
2252
|
;
|
|
2201
2253
|
|
|
@@ -2244,7 +2296,7 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2244
2296
|
* Returns the signed in account matching localAccountId.
|
|
2245
2297
|
* (the account object is created at the time of successful login)
|
|
2246
2298
|
* or null when no matching account is found
|
|
2247
|
-
* @
|
|
2299
|
+
* @param localAccountId - unique identifier of an account (sub/obj when homeAccountId cannot be populated)
|
|
2248
2300
|
*/
|
|
2249
2301
|
;
|
|
2250
2302
|
|
|
@@ -2291,7 +2343,7 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2291
2343
|
}()
|
|
2292
2344
|
/**
|
|
2293
2345
|
* API to remove a specific account and the relevant data from cache
|
|
2294
|
-
* @param account
|
|
2346
|
+
* @param account - AccountInfo passed by the user
|
|
2295
2347
|
*/
|
|
2296
2348
|
;
|
|
2297
2349
|
|
|
@@ -2357,8 +2409,8 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2357
2409
|
}
|
|
2358
2410
|
/**
|
|
2359
2411
|
* Merge in memory cache with the cache snapshot.
|
|
2360
|
-
* @param oldState
|
|
2361
|
-
* @param currentState
|
|
2412
|
+
* @param oldState - cache before changes
|
|
2413
|
+
* @param currentState - current cache state in the library
|
|
2362
2414
|
*/
|
|
2363
2415
|
;
|
|
2364
2416
|
|
|
@@ -2369,8 +2421,8 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2369
2421
|
}
|
|
2370
2422
|
/**
|
|
2371
2423
|
* Deep update of oldState based on newState values
|
|
2372
|
-
* @param oldState
|
|
2373
|
-
* @param newState
|
|
2424
|
+
* @param oldState - cache before changes
|
|
2425
|
+
* @param newState - updated cache
|
|
2374
2426
|
*/
|
|
2375
2427
|
;
|
|
2376
2428
|
|
|
@@ -2403,8 +2455,8 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2403
2455
|
/**
|
|
2404
2456
|
* Removes entities in oldState that the were removed from newState. If there are any unknown values in root of
|
|
2405
2457
|
* oldState that are not recognized, they are left untouched.
|
|
2406
|
-
* @param oldState
|
|
2407
|
-
* @param newState
|
|
2458
|
+
* @param oldState - cache before changes
|
|
2459
|
+
* @param newState - updated cache
|
|
2408
2460
|
*/
|
|
2409
2461
|
;
|
|
2410
2462
|
|
|
@@ -2422,7 +2474,13 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2422
2474
|
IdToken: idTokens,
|
|
2423
2475
|
AppMetadata: appMetadata
|
|
2424
2476
|
});
|
|
2425
|
-
}
|
|
2477
|
+
}
|
|
2478
|
+
/**
|
|
2479
|
+
* Helper to merge new cache with the old one
|
|
2480
|
+
* @param oldState - cache before changes
|
|
2481
|
+
* @param newState - updated cache
|
|
2482
|
+
*/
|
|
2483
|
+
;
|
|
2426
2484
|
|
|
2427
2485
|
_proto.mergeRemovalsDict = function mergeRemovalsDict(oldState, newState) {
|
|
2428
2486
|
var finalState = _extends({}, oldState);
|
|
@@ -2433,7 +2491,12 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2433
2491
|
}
|
|
2434
2492
|
});
|
|
2435
2493
|
return finalState;
|
|
2436
|
-
}
|
|
2494
|
+
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Helper to overlay as a part of cache merge
|
|
2497
|
+
* @param passedInCache - cache read from the blob
|
|
2498
|
+
*/
|
|
2499
|
+
;
|
|
2437
2500
|
|
|
2438
2501
|
_proto.overlayDefaults = function overlayDefaults(passedInCache) {
|
|
2439
2502
|
this.logger.verbose("Overlaying input cache with the default cache");
|
|
@@ -2449,8 +2512,14 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2449
2512
|
return TokenCache;
|
|
2450
2513
|
}();
|
|
2451
2514
|
|
|
2515
|
+
/* eslint-disable header/header */
|
|
2452
2516
|
var name = "@azure/msal-node";
|
|
2453
|
-
var version = "1.0.0-beta.
|
|
2517
|
+
var version = "1.0.0-beta.6";
|
|
2518
|
+
|
|
2519
|
+
/**
|
|
2520
|
+
* Base abstract class for all ClientApplications - public and confidential
|
|
2521
|
+
* @public
|
|
2522
|
+
*/
|
|
2454
2523
|
|
|
2455
2524
|
var ClientApplication = /*#__PURE__*/function () {
|
|
2456
2525
|
/**
|
|
@@ -2460,9 +2529,8 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2460
2529
|
this.config = buildAppConfiguration(configuration);
|
|
2461
2530
|
this.cryptoProvider = new CryptoProvider();
|
|
2462
2531
|
this.logger = new Logger(this.config.system.loggerOptions, name, version);
|
|
2463
|
-
this.storage = new
|
|
2532
|
+
this.storage = new NodeStorage(this.logger, this.config.auth.clientId, this.cryptoProvider);
|
|
2464
2533
|
this.tokenCache = new TokenCache(this.storage, this.logger, this.config.cache.cachePlugin);
|
|
2465
|
-
TrustedAuthority.setTrustedAuthoritiesFromConfig(this.config.auth.knownAuthorities, this.config.auth.cloudDiscoveryMetadata);
|
|
2466
2534
|
}
|
|
2467
2535
|
/**
|
|
2468
2536
|
* Creates the URL of the authorization request, letting the user input credentials and consent to the
|
|
@@ -2692,74 +2760,65 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2692
2760
|
}
|
|
2693
2761
|
/**
|
|
2694
2762
|
* Replaces the default logger set in configurations with new Logger with new configurations
|
|
2695
|
-
* @param logger Logger instance
|
|
2763
|
+
* @param logger - Logger instance
|
|
2696
2764
|
*/
|
|
2697
2765
|
;
|
|
2698
2766
|
|
|
2699
2767
|
_proto.setLogger = function setLogger(logger) {
|
|
2700
2768
|
this.logger = logger;
|
|
2701
|
-
}
|
|
2769
|
+
}
|
|
2770
|
+
/**
|
|
2771
|
+
* Builds the common configuration to be passed to the common component based on the platform configurarion
|
|
2772
|
+
* @param authority - user passed authority in configuration
|
|
2773
|
+
* @param serverTelemetryManager - initializes servertelemetry if passed
|
|
2774
|
+
*/
|
|
2775
|
+
;
|
|
2702
2776
|
|
|
2703
|
-
_proto.buildOauthClientConfiguration =
|
|
2777
|
+
_proto.buildOauthClientConfiguration =
|
|
2778
|
+
/*#__PURE__*/
|
|
2779
|
+
function () {
|
|
2704
2780
|
var _buildOauthClientConfiguration = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(authority, serverTelemetryManager) {
|
|
2781
|
+
var discoveredAuthority;
|
|
2705
2782
|
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2706
2783
|
while (1) {
|
|
2707
2784
|
switch (_context5.prev = _context5.next) {
|
|
2708
2785
|
case 0:
|
|
2709
2786
|
this.logger.verbose("buildOauthClientConfiguration called"); // using null assertion operator as we ensure that all config values have default values in buildConfiguration()
|
|
2710
2787
|
|
|
2711
|
-
_context5.
|
|
2712
|
-
_context5.next = 4;
|
|
2788
|
+
_context5.next = 3;
|
|
2713
2789
|
return this.createAuthority(authority);
|
|
2714
2790
|
|
|
2715
|
-
case
|
|
2716
|
-
|
|
2717
|
-
_context5.t2 = this.config.auth.knownAuthorities;
|
|
2718
|
-
_context5.t3 = this.config.auth.cloudDiscoveryMetadata;
|
|
2719
|
-
_context5.t4 = this.config.auth.clientCapabilities;
|
|
2720
|
-
_context5.t5 = this.config.auth.protocolMode;
|
|
2721
|
-
_context5.t6 = {
|
|
2722
|
-
clientId: _context5.t0,
|
|
2723
|
-
authority: _context5.t1,
|
|
2724
|
-
knownAuthorities: _context5.t2,
|
|
2725
|
-
cloudDiscoveryMetadata: _context5.t3,
|
|
2726
|
-
clientCapabilities: _context5.t4,
|
|
2727
|
-
protocolMode: _context5.t5
|
|
2728
|
-
};
|
|
2729
|
-
_context5.t7 = {
|
|
2730
|
-
loggerCallback: this.config.system.loggerOptions.loggerCallback,
|
|
2731
|
-
piiLoggingEnabled: this.config.system.loggerOptions.piiLoggingEnabled
|
|
2732
|
-
};
|
|
2733
|
-
_context5.t8 = this.cryptoProvider;
|
|
2734
|
-
_context5.t9 = this.config.system.networkClient;
|
|
2735
|
-
_context5.t10 = this.storage;
|
|
2736
|
-
_context5.t11 = serverTelemetryManager;
|
|
2737
|
-
_context5.t12 = {
|
|
2738
|
-
clientSecret: this.clientSecret,
|
|
2739
|
-
clientAssertion: this.clientAssertion ? this.getClientAssertion() : undefined
|
|
2740
|
-
};
|
|
2741
|
-
_context5.t13 = {
|
|
2742
|
-
sku: Constants.MSAL_SKU,
|
|
2743
|
-
version: version,
|
|
2744
|
-
cpu: process.arch || "",
|
|
2745
|
-
os: process.platform || ""
|
|
2746
|
-
};
|
|
2747
|
-
_context5.t14 = this.config.cache.cachePlugin;
|
|
2748
|
-
_context5.t15 = this.tokenCache;
|
|
2791
|
+
case 3:
|
|
2792
|
+
discoveredAuthority = _context5.sent;
|
|
2749
2793
|
return _context5.abrupt("return", {
|
|
2750
|
-
authOptions:
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2794
|
+
authOptions: {
|
|
2795
|
+
clientId: this.config.auth.clientId,
|
|
2796
|
+
authority: discoveredAuthority,
|
|
2797
|
+
clientCapabilities: this.config.auth.clientCapabilities
|
|
2798
|
+
},
|
|
2799
|
+
loggerOptions: {
|
|
2800
|
+
loggerCallback: this.config.system.loggerOptions.loggerCallback,
|
|
2801
|
+
piiLoggingEnabled: this.config.system.loggerOptions.piiLoggingEnabled
|
|
2802
|
+
},
|
|
2803
|
+
cryptoInterface: this.cryptoProvider,
|
|
2804
|
+
networkInterface: this.config.system.networkClient,
|
|
2805
|
+
storageInterface: this.storage,
|
|
2806
|
+
serverTelemetryManager: serverTelemetryManager,
|
|
2807
|
+
clientCredentials: {
|
|
2808
|
+
clientSecret: this.clientSecret,
|
|
2809
|
+
clientAssertion: this.clientAssertion ? this.getClientAssertion(discoveredAuthority) : undefined
|
|
2810
|
+
},
|
|
2811
|
+
libraryInfo: {
|
|
2812
|
+
sku: Constants.MSAL_SKU,
|
|
2813
|
+
version: version,
|
|
2814
|
+
cpu: process.arch || "",
|
|
2815
|
+
os: process.platform || ""
|
|
2816
|
+
},
|
|
2817
|
+
persistencePlugin: this.config.cache.cachePlugin,
|
|
2818
|
+
serializableCache: this.tokenCache
|
|
2760
2819
|
});
|
|
2761
2820
|
|
|
2762
|
-
case
|
|
2821
|
+
case 5:
|
|
2763
2822
|
case "end":
|
|
2764
2823
|
return _context5.stop();
|
|
2765
2824
|
}
|
|
@@ -2774,26 +2833,33 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2774
2833
|
return buildOauthClientConfiguration;
|
|
2775
2834
|
}();
|
|
2776
2835
|
|
|
2777
|
-
_proto.getClientAssertion = function getClientAssertion() {
|
|
2836
|
+
_proto.getClientAssertion = function getClientAssertion(authority) {
|
|
2778
2837
|
return {
|
|
2779
|
-
assertion: this.clientAssertion.getJwt(this.cryptoProvider, this.config.auth.clientId,
|
|
2838
|
+
assertion: this.clientAssertion.getJwt(this.cryptoProvider, this.config.auth.clientId, authority.tokenEndpoint),
|
|
2780
2839
|
assertionType: Constants.JWT_BEARER_ASSERTION_TYPE
|
|
2781
2840
|
};
|
|
2782
2841
|
}
|
|
2783
2842
|
/**
|
|
2784
2843
|
* Generates a request with the default scopes & generates a correlationId.
|
|
2785
|
-
* @param authRequest
|
|
2844
|
+
* @param authRequest - BaseAuthRequest for initialization
|
|
2786
2845
|
*/
|
|
2787
2846
|
;
|
|
2788
2847
|
|
|
2789
2848
|
_proto.initializeBaseRequest = function initializeBaseRequest(authRequest) {
|
|
2790
2849
|
this.logger.verbose("initializeRequestScopes called");
|
|
2791
2850
|
return _extends({}, authRequest, {
|
|
2792
|
-
scopes: [].concat(authRequest && authRequest.scopes || [],
|
|
2851
|
+
scopes: [].concat(authRequest && authRequest.scopes || [], OIDC_DEFAULT_SCOPES),
|
|
2793
2852
|
correlationId: authRequest && authRequest.correlationId || this.cryptoProvider.createNewGuid(),
|
|
2794
2853
|
authority: authRequest.authority || this.config.auth.authority
|
|
2795
2854
|
});
|
|
2796
|
-
}
|
|
2855
|
+
}
|
|
2856
|
+
/**
|
|
2857
|
+
* Initializes the server telemetry payload
|
|
2858
|
+
* @param apiId - Id for a specific request
|
|
2859
|
+
* @param correlationId - GUID
|
|
2860
|
+
* @param forceRefresh - boolean to indicate network call
|
|
2861
|
+
*/
|
|
2862
|
+
;
|
|
2797
2863
|
|
|
2798
2864
|
_proto.initializeServerTelemetryManager = function initializeServerTelemetryManager(apiId, correlationId, forceRefresh) {
|
|
2799
2865
|
var telemetryPayload = {
|
|
@@ -2807,7 +2873,7 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2807
2873
|
/**
|
|
2808
2874
|
* Create authority instance. If authority not passed in request, default to authority set on the application
|
|
2809
2875
|
* object. If no authority set in application object, then default to common authority.
|
|
2810
|
-
* @param authorityString
|
|
2876
|
+
* @param authorityString - authority from user configuration
|
|
2811
2877
|
*/
|
|
2812
2878
|
;
|
|
2813
2879
|
|
|
@@ -2815,47 +2881,30 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2815
2881
|
/*#__PURE__*/
|
|
2816
2882
|
function () {
|
|
2817
2883
|
var _createAuthority = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(authorityString) {
|
|
2818
|
-
var
|
|
2884
|
+
var authorityOptions;
|
|
2819
2885
|
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2820
2886
|
while (1) {
|
|
2821
2887
|
switch (_context6.prev = _context6.next) {
|
|
2822
2888
|
case 0:
|
|
2823
2889
|
this.logger.verbose("createAuthority called");
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
this.
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
if (!authority.discoveryComplete()) {
|
|
2834
|
-
_context6.next = 4;
|
|
2835
|
-
break;
|
|
2836
|
-
}
|
|
2837
|
-
|
|
2838
|
-
return _context6.abrupt("return", authority);
|
|
2890
|
+
authorityOptions = {
|
|
2891
|
+
protocolMode: this.config.auth.protocolMode,
|
|
2892
|
+
knownAuthorities: this.config.auth.knownAuthorities,
|
|
2893
|
+
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
2894
|
+
authorityMetadata: this.config.auth.authorityMetadata
|
|
2895
|
+
};
|
|
2896
|
+
_context6.next = 4;
|
|
2897
|
+
return AuthorityFactory.createDiscoveredInstance(authorityString, this.config.system.networkClient, this.storage, authorityOptions);
|
|
2839
2898
|
|
|
2840
2899
|
case 4:
|
|
2841
|
-
_context6.
|
|
2842
|
-
_context6.next = 7;
|
|
2843
|
-
return authority.resolveEndpointsAsync();
|
|
2844
|
-
|
|
2845
|
-
case 7:
|
|
2846
|
-
return _context6.abrupt("return", authority);
|
|
2847
|
-
|
|
2848
|
-
case 10:
|
|
2849
|
-
_context6.prev = 10;
|
|
2850
|
-
_context6.t0 = _context6["catch"](4);
|
|
2851
|
-
throw ClientAuthError.createEndpointDiscoveryIncompleteError(_context6.t0);
|
|
2900
|
+
return _context6.abrupt("return", _context6.sent);
|
|
2852
2901
|
|
|
2853
|
-
case
|
|
2902
|
+
case 5:
|
|
2854
2903
|
case "end":
|
|
2855
2904
|
return _context6.stop();
|
|
2856
2905
|
}
|
|
2857
2906
|
}
|
|
2858
|
-
}, _callee6, this
|
|
2907
|
+
}, _callee6, this);
|
|
2859
2908
|
}));
|
|
2860
2909
|
|
|
2861
2910
|
function createAuthority(_x7) {
|
|
@@ -2865,24 +2914,13 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2865
2914
|
return createAuthority;
|
|
2866
2915
|
}();
|
|
2867
2916
|
|
|
2868
|
-
_createClass(ClientApplication, [{
|
|
2869
|
-
key: "authority",
|
|
2870
|
-
get: function get() {
|
|
2871
|
-
if (this._authority) {
|
|
2872
|
-
return this._authority;
|
|
2873
|
-
}
|
|
2874
|
-
|
|
2875
|
-
this._authority = AuthorityFactory.createInstance(this.config.auth.authority, this.config.system.networkClient, this.config.auth.protocolMode);
|
|
2876
|
-
return this._authority;
|
|
2877
|
-
}
|
|
2878
|
-
}]);
|
|
2879
|
-
|
|
2880
2917
|
return ClientApplication;
|
|
2881
2918
|
}();
|
|
2882
2919
|
|
|
2883
2920
|
/**
|
|
2884
2921
|
* This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
|
|
2885
2922
|
* are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
|
|
2923
|
+
* @public
|
|
2886
2924
|
*/
|
|
2887
2925
|
|
|
2888
2926
|
var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
@@ -2893,17 +2931,17 @@ var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
|
2893
2931
|
* - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal.
|
|
2894
2932
|
* - authority: the authority URL for your application.
|
|
2895
2933
|
*
|
|
2896
|
-
* AAD authorities are of the form https://login.microsoftonline.com
|
|
2934
|
+
* AAD authorities are of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
|
|
2897
2935
|
* - If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
|
|
2898
2936
|
* - If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
|
|
2899
2937
|
* - If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
|
|
2900
2938
|
* - To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
|
|
2901
2939
|
*
|
|
2902
|
-
* Azure B2C authorities are of the form https
|
|
2940
|
+
* Azure B2C authorities are of the form https://\{instance\}/\{tenant\}/\{policy\}. Each policy is considered
|
|
2903
2941
|
* its own authority. You will have to set the all of the knownAuthorities at the time of the client application
|
|
2904
2942
|
* construction.
|
|
2905
2943
|
*
|
|
2906
|
-
* ADFS authorities are of the form https
|
|
2944
|
+
* ADFS authorities are of the form https://\{instance\}/adfs.
|
|
2907
2945
|
*/
|
|
2908
2946
|
function PublicClientApplication(configuration) {
|
|
2909
2947
|
return _ClientApplication.call(this, configuration) || this;
|
|
@@ -2971,7 +3009,7 @@ var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
|
2971
3009
|
* Microsoft's documentation and recommendations are at:
|
|
2972
3010
|
* https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#usernamepassword
|
|
2973
3011
|
*
|
|
2974
|
-
* @param request
|
|
3012
|
+
* @param request - UsenamePasswordRequest
|
|
2975
3013
|
*/
|
|
2976
3014
|
;
|
|
2977
3015
|
|
|
@@ -3027,16 +3065,28 @@ var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
|
3027
3065
|
*/
|
|
3028
3066
|
/**
|
|
3029
3067
|
* Client assertion of type jwt-bearer used in confidential client flows
|
|
3068
|
+
* @public
|
|
3030
3069
|
*/
|
|
3031
3070
|
|
|
3032
3071
|
var ClientAssertion = /*#__PURE__*/function () {
|
|
3033
3072
|
function ClientAssertion() {}
|
|
3034
3073
|
|
|
3074
|
+
/**
|
|
3075
|
+
* Initialize the ClientAssertion class from the clientAssertion passed by the user
|
|
3076
|
+
* @param assertion - refer https://tools.ietf.org/html/rfc7521
|
|
3077
|
+
*/
|
|
3035
3078
|
ClientAssertion.fromAssertion = function fromAssertion(assertion) {
|
|
3036
3079
|
var clientAssertion = new ClientAssertion();
|
|
3037
3080
|
clientAssertion.jwt = assertion;
|
|
3038
3081
|
return clientAssertion;
|
|
3039
|
-
}
|
|
3082
|
+
}
|
|
3083
|
+
/**
|
|
3084
|
+
* Initialize the ClientAssertion class from the certificate passed by the user
|
|
3085
|
+
* @param thumbprint - identifier of a certificate
|
|
3086
|
+
* @param privateKey - secret key
|
|
3087
|
+
* @param publicCertificate - electronic document provided to prove the ownership of the public key
|
|
3088
|
+
*/
|
|
3089
|
+
;
|
|
3040
3090
|
|
|
3041
3091
|
ClientAssertion.fromCertificate = function fromCertificate(thumbprint, privateKey, publicCertificate) {
|
|
3042
3092
|
var clientAssertion = new ClientAssertion();
|
|
@@ -3048,7 +3098,14 @@ var ClientAssertion = /*#__PURE__*/function () {
|
|
|
3048
3098
|
}
|
|
3049
3099
|
|
|
3050
3100
|
return clientAssertion;
|
|
3051
|
-
}
|
|
3101
|
+
}
|
|
3102
|
+
/**
|
|
3103
|
+
* Update JWT for certificate based clientAssertion, if passed by the user, uses it as is
|
|
3104
|
+
* @param cryptoProvider - library's crypto helper
|
|
3105
|
+
* @param issuer - iss claim
|
|
3106
|
+
* @param jwtAudience - aud claim
|
|
3107
|
+
*/
|
|
3108
|
+
;
|
|
3052
3109
|
|
|
3053
3110
|
var _proto = ClientAssertion.prototype;
|
|
3054
3111
|
|
|
@@ -3072,7 +3129,10 @@ var ClientAssertion = /*#__PURE__*/function () {
|
|
|
3072
3129
|
}
|
|
3073
3130
|
|
|
3074
3131
|
throw ClientAuthError.createInvalidAssertionError();
|
|
3075
|
-
}
|
|
3132
|
+
}
|
|
3133
|
+
/**
|
|
3134
|
+
* JWT format and required claims specified: https://tools.ietf.org/html/rfc7523#section-3
|
|
3135
|
+
*/
|
|
3076
3136
|
;
|
|
3077
3137
|
|
|
3078
3138
|
_proto.createJwt = function createJwt(cryptoProvider, issuer, jwtAudience) {
|
|
@@ -3095,14 +3155,18 @@ var ClientAssertion = /*#__PURE__*/function () {
|
|
|
3095
3155
|
header: header
|
|
3096
3156
|
});
|
|
3097
3157
|
return this.jwt;
|
|
3098
|
-
}
|
|
3158
|
+
}
|
|
3159
|
+
/**
|
|
3160
|
+
* Utility API to check expiration
|
|
3161
|
+
*/
|
|
3162
|
+
;
|
|
3099
3163
|
|
|
3100
3164
|
_proto.isExpired = function isExpired() {
|
|
3101
3165
|
return this.expirationTime < TimeUtils.nowSeconds();
|
|
3102
3166
|
}
|
|
3103
3167
|
/**
|
|
3104
3168
|
* Extracts the raw certs from a given certificate string and returns them in an array.
|
|
3105
|
-
* @param publicCertificate
|
|
3169
|
+
* @param publicCertificate - electronic document provided to prove the ownership of the public key
|
|
3106
3170
|
*/
|
|
3107
3171
|
;
|
|
3108
3172
|
|
|
@@ -3112,15 +3176,15 @@ var ClientAssertion = /*#__PURE__*/function () {
|
|
|
3112
3176
|
* We want to look for the contents between the BEGIN and END certificate strings, without the associated newlines.
|
|
3113
3177
|
* The information in parens "(.+?)" is the capture group to represent the cert we want isolated.
|
|
3114
3178
|
* "." means any string character, "+" means match 1 or more times, and "?" means the shortest match.
|
|
3115
|
-
* The "g" at the end of the regex means search the string globally, and the "
|
|
3179
|
+
* The "g" at the end of the regex means search the string globally, and the "s" enables the "." to match newlines.
|
|
3116
3180
|
*/
|
|
3117
|
-
var regexToFindCerts =
|
|
3181
|
+
var regexToFindCerts = /\x2D\x2D\x2D\x2D\x2DBEGIN CERTIFICATE\x2D\x2D\x2D\x2D\x2D\n([\s\S]+?)\n\x2D\x2D\x2D\x2D\x2DEND CERTIFICATE\x2D\x2D\x2D\x2D\x2D/g;
|
|
3118
3182
|
var certs = [];
|
|
3119
3183
|
var matches;
|
|
3120
3184
|
|
|
3121
3185
|
while ((matches = regexToFindCerts.exec(publicCertificate)) !== null) {
|
|
3122
3186
|
// matches[1] represents the first parens capture group in the regex.
|
|
3123
|
-
certs.push(matches[1]);
|
|
3187
|
+
certs.push(matches[1].replace(/\n/, ""));
|
|
3124
3188
|
}
|
|
3125
3189
|
|
|
3126
3190
|
return certs;
|
|
@@ -3129,11 +3193,16 @@ var ClientAssertion = /*#__PURE__*/function () {
|
|
|
3129
3193
|
return ClientAssertion;
|
|
3130
3194
|
}();
|
|
3131
3195
|
|
|
3196
|
+
/**
|
|
3197
|
+
* This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
|
|
3198
|
+
* will configure application secrets, client certificates/assertions as applicable
|
|
3199
|
+
* @public
|
|
3200
|
+
*/
|
|
3201
|
+
|
|
3132
3202
|
var ConfidentialClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
3133
3203
|
_inheritsLoose(ConfidentialClientApplication, _ClientApplication);
|
|
3134
3204
|
|
|
3135
3205
|
/**
|
|
3136
|
-
* @constructor
|
|
3137
3206
|
* Constructor for the ConfidentialClientApplication
|
|
3138
3207
|
*
|
|
3139
3208
|
* Required attributes in the Configuration object are:
|
|
@@ -3141,16 +3210,16 @@ var ConfidentialClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
|
3141
3210
|
* - authority: the authority URL for your application.
|
|
3142
3211
|
* - client credential: Must set either client secret, certificate, or assertion for confidential clients. You can obtain a client secret from the application registration portal.
|
|
3143
3212
|
*
|
|
3144
|
-
* In Azure AD, authority is a URL indicating of the form https://login.microsoftonline.com
|
|
3213
|
+
* In Azure AD, authority is a URL indicating of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
|
|
3145
3214
|
* If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
|
|
3146
3215
|
* If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
|
|
3147
3216
|
* If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
|
|
3148
3217
|
* To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
|
|
3149
3218
|
*
|
|
3150
|
-
* In Azure B2C, authority is of the form https
|
|
3219
|
+
* In Azure B2C, authority is of the form https://\{instance\}/tfp/\{tenant\}/\{policyName\}/
|
|
3151
3220
|
* Full B2C functionality will be available in this library in future versions.
|
|
3152
3221
|
*
|
|
3153
|
-
* @param
|
|
3222
|
+
* @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
|
|
3154
3223
|
*/
|
|
3155
3224
|
function ConfidentialClientApplication(configuration) {
|
|
3156
3225
|
var _this;
|
|
@@ -3290,5 +3359,5 @@ var ConfidentialClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
|
3290
3359
|
return ConfidentialClientApplication;
|
|
3291
3360
|
}(ClientApplication);
|
|
3292
3361
|
|
|
3293
|
-
export {
|
|
3362
|
+
export { ClientApplication, ClientAssertion, ConfidentialClientApplication, CryptoProvider, NodeStorage, PublicClientApplication, TokenCache, buildAppConfiguration };
|
|
3294
3363
|
//# sourceMappingURL=msal-node.esm.js.map
|