@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.
Files changed (70) hide show
  1. package/CHANGELOG.json +144 -0
  2. package/README.md +1 -1
  3. package/changelog.md +43 -1
  4. package/dist/cache/ITokenCache.d.ts +16 -0
  5. package/dist/cache/ITokenCache.d.ts.map +1 -0
  6. package/dist/cache/{Storage.d.ts → NodeStorage.d.ts} +55 -31
  7. package/dist/cache/NodeStorage.d.ts.map +1 -0
  8. package/dist/cache/TokenCache.d.ts +30 -13
  9. package/dist/cache/TokenCache.d.ts.map +1 -0
  10. package/dist/cache/serializer/Deserializer.d.ts +1 -0
  11. package/dist/cache/serializer/Deserializer.d.ts.map +1 -0
  12. package/dist/cache/serializer/Serializer.d.ts +1 -0
  13. package/dist/cache/serializer/Serializer.d.ts.map +1 -0
  14. package/dist/cache/serializer/SerializerTypes.d.ts +33 -0
  15. package/dist/cache/serializer/SerializerTypes.d.ts.map +1 -0
  16. package/dist/client/ClientApplication.d.ts +36 -7
  17. package/dist/client/ClientApplication.d.ts.map +1 -0
  18. package/dist/client/ClientAssertion.d.ts +25 -1
  19. package/dist/client/ClientAssertion.d.ts.map +1 -0
  20. package/dist/client/ConfidentialClientApplication.d.ts +11 -5
  21. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -0
  22. package/dist/client/IConfidentialClientApplication.d.ts +33 -0
  23. package/dist/client/IConfidentialClientApplication.d.ts.map +1 -0
  24. package/dist/client/IPublicClientApplication.d.ts +33 -0
  25. package/dist/client/IPublicClientApplication.d.ts.map +1 -0
  26. package/dist/client/PublicClientApplication.d.ts +8 -5
  27. package/dist/client/PublicClientApplication.d.ts.map +1 -0
  28. package/dist/config/Configuration.d.ts +10 -3
  29. package/dist/config/Configuration.d.ts.map +1 -0
  30. package/dist/crypto/CryptoProvider.d.ts +10 -2
  31. package/dist/crypto/CryptoProvider.d.ts.map +1 -0
  32. package/dist/crypto/GuidGenerator.d.ts +1 -0
  33. package/dist/crypto/GuidGenerator.d.ts.map +1 -0
  34. package/dist/crypto/PkceGenerator.d.ts +1 -0
  35. package/dist/crypto/PkceGenerator.d.ts.map +1 -0
  36. package/dist/index.d.ts +15 -5
  37. package/dist/index.d.ts.map +1 -0
  38. package/dist/msal-node.cjs.development.js +274 -205
  39. package/dist/msal-node.cjs.development.js.map +1 -1
  40. package/dist/msal-node.cjs.production.min.js +1 -1
  41. package/dist/msal-node.cjs.production.min.js.map +1 -1
  42. package/dist/msal-node.esm.js +273 -204
  43. package/dist/msal-node.esm.js.map +1 -1
  44. package/dist/network/HttpClient.d.ts +1 -1
  45. package/dist/network/HttpClient.d.ts.map +1 -0
  46. package/dist/packageMetadata.d.ts +3 -0
  47. package/dist/packageMetadata.d.ts.map +1 -0
  48. package/dist/request/AuthorizationCodeRequest.d.ts +3 -1
  49. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -0
  50. package/dist/request/AuthorizationUrlRequest.d.ts +3 -1
  51. package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -0
  52. package/dist/request/ClientCredentialRequest.d.ts +3 -1
  53. package/dist/request/ClientCredentialRequest.d.ts.map +1 -0
  54. package/dist/request/DeviceCodeRequest.d.ts +3 -1
  55. package/dist/request/DeviceCodeRequest.d.ts.map +1 -0
  56. package/dist/request/OnBehalfOfRequest.d.ts +3 -1
  57. package/dist/request/OnBehalfOfRequest.d.ts.map +1 -0
  58. package/dist/request/RefreshTokenRequest.d.ts +3 -1
  59. package/dist/request/RefreshTokenRequest.d.ts.map +1 -0
  60. package/dist/request/SilentFlowRequest.d.ts +3 -1
  61. package/dist/request/SilentFlowRequest.d.ts.map +1 -0
  62. package/dist/request/UsernamePasswordRequest.d.ts +3 -1
  63. package/dist/request/UsernamePasswordRequest.d.ts.map +1 -0
  64. package/dist/utils/Constants.d.ts +1 -0
  65. package/dist/utils/Constants.d.ts.map +1 -0
  66. package/dist/utils/EncodingUtils.d.ts +1 -0
  67. package/dist/utils/EncodingUtils.d.ts.map +1 -0
  68. package/dist/utils/NetworkUtils.d.ts +1 -0
  69. package/dist/utils/NetworkUtils.d.ts.map +1 -0
  70. package/package.json +8 -12
@@ -46,22 +46,6 @@ function _asyncToGenerator(fn) {
46
46
  };
47
47
  }
48
48
 
49
- function _defineProperties(target, props) {
50
- for (var i = 0; i < props.length; i++) {
51
- var descriptor = props[i];
52
- descriptor.enumerable = descriptor.enumerable || false;
53
- descriptor.configurable = true;
54
- if ("value" in descriptor) descriptor.writable = true;
55
- Object.defineProperty(target, descriptor.key, descriptor);
56
- }
57
- }
58
-
59
- function _createClass(Constructor, protoProps, staticProps) {
60
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
61
- if (staticProps) _defineProperties(Constructor, staticProps);
62
- return Constructor;
63
- }
64
-
65
49
  function _extends() {
66
50
  _extends = Object.assign || function (target) {
67
51
  for (var i = 1; i < arguments.length; i++) {
@@ -923,20 +907,15 @@ var JwtConstants = {
923
907
  */
924
908
 
925
909
  var HttpClient = /*#__PURE__*/function () {
926
- function HttpClient() {
927
- axios.defaults.validateStatus = function () {
928
- return true;
929
- };
930
- }
910
+ function HttpClient() {}
911
+
912
+ var _proto = HttpClient.prototype;
913
+
931
914
  /**
932
915
  * Http Get request
933
916
  * @param url
934
917
  * @param options
935
918
  */
936
-
937
-
938
- var _proto = HttpClient.prototype;
939
-
940
919
  _proto.sendGetRequestAsync =
941
920
  /*#__PURE__*/
942
921
  function () {
@@ -949,7 +928,10 @@ var HttpClient = /*#__PURE__*/function () {
949
928
  request = {
950
929
  method: HttpMethod.GET,
951
930
  url: url,
952
- headers: options && options.headers
931
+ headers: options && options.headers,
932
+ validateStatus: function validateStatus() {
933
+ return true;
934
+ }
953
935
  };
954
936
  _context.next = 3;
955
937
  return axios(request);
@@ -996,7 +978,10 @@ var HttpClient = /*#__PURE__*/function () {
996
978
  method: HttpMethod.POST,
997
979
  url: url,
998
980
  data: options && options.body || "",
999
- headers: options && options.headers
981
+ headers: options && options.headers,
982
+ validateStatus: function validateStatus() {
983
+ return true;
984
+ }
1000
985
  };
1001
986
  _context2.next = 3;
1002
987
  return axios(request);
@@ -1056,6 +1041,7 @@ var DEFAULT_AUTH_OPTIONS = {
1056
1041
  },
1057
1042
  knownAuthorities: [],
1058
1043
  cloudDiscoveryMetadata: "",
1044
+ authorityMetadata: "",
1059
1045
  clientCapabilities: [],
1060
1046
  protocolMode: msalCommon.ProtocolMode.AAD
1061
1047
  };
@@ -1073,11 +1059,12 @@ var DEFAULT_SYSTEM_OPTIONS = {
1073
1059
  /**
1074
1060
  * Sets the default options when not explicitly configured from app developer
1075
1061
  *
1076
- * @param auth
1077
- * @param cache
1078
- * @param system
1062
+ * @param auth - Authentication options
1063
+ * @param cache - Cache options
1064
+ * @param system - System options
1079
1065
  *
1080
1066
  * @returns Configuration
1067
+ * @public
1081
1068
  */
1082
1069
 
1083
1070
  function buildAppConfiguration(_ref) {
@@ -1234,7 +1221,7 @@ var PkceGenerator = /*#__PURE__*/function () {
1234
1221
  ;
1235
1222
 
1236
1223
  _proto.generateCodeChallengeFromVerifier = function generateCodeChallengeFromVerifier(codeVerifier) {
1237
- return EncodingUtils.base64EncodeUrl(this.sha256(codeVerifier).toString("ascii"));
1224
+ return EncodingUtils.base64EncodeUrl(this.sha256(codeVerifier).toString("base64"), "base64");
1238
1225
  }
1239
1226
  /**
1240
1227
  * generate 'SHA256' hash
@@ -1272,6 +1259,7 @@ var PkceGenerator = /*#__PURE__*/function () {
1272
1259
  /**
1273
1260
  * This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
1274
1261
  * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
1262
+ * @public
1275
1263
  */
1276
1264
 
1277
1265
  var CryptoProvider = /*#__PURE__*/function () {
@@ -1292,7 +1280,7 @@ var CryptoProvider = /*#__PURE__*/function () {
1292
1280
  }
1293
1281
  /**
1294
1282
  * Encodes input string to base64.
1295
- * @param input
1283
+ * @param input - string to be encoded
1296
1284
  */
1297
1285
  ;
1298
1286
 
@@ -1301,7 +1289,7 @@ var CryptoProvider = /*#__PURE__*/function () {
1301
1289
  }
1302
1290
  /**
1303
1291
  * Decodes input string from base64.
1304
- * @param input
1292
+ * @param input - string to be decoded
1305
1293
  */
1306
1294
  ;
1307
1295
 
@@ -1315,11 +1303,19 @@ var CryptoProvider = /*#__PURE__*/function () {
1315
1303
 
1316
1304
  _proto.generatePkceCodes = function generatePkceCodes() {
1317
1305
  return this.pkceGenerator.generatePkceCodes();
1318
- };
1306
+ }
1307
+ /**
1308
+ * Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
1309
+ */
1310
+ ;
1319
1311
 
1320
1312
  _proto.getPublicKeyThumbprint = function getPublicKeyThumbprint() {
1321
1313
  throw new Error("Method not implemented.");
1322
- };
1314
+ }
1315
+ /**
1316
+ * Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
1317
+ */
1318
+ ;
1323
1319
 
1324
1320
  _proto.signJwt = function signJwt() {
1325
1321
  throw new Error("Method not implemented.");
@@ -1666,12 +1662,13 @@ var Serializer = /*#__PURE__*/function () {
1666
1662
 
1667
1663
  /**
1668
1664
  * This class implements Storage for node, reading cache from user specified storage location or an extension library
1665
+ * @public
1669
1666
  */
1670
1667
 
1671
- var Storage = /*#__PURE__*/function (_CacheManager) {
1672
- _inheritsLoose(Storage, _CacheManager);
1668
+ var NodeStorage = /*#__PURE__*/function (_CacheManager) {
1669
+ _inheritsLoose(NodeStorage, _CacheManager);
1673
1670
 
1674
- function Storage(logger, clientId, cryptoImpl) {
1671
+ function NodeStorage(logger, clientId, cryptoImpl) {
1675
1672
  var _this;
1676
1673
 
1677
1674
  _this = _CacheManager.call(this, clientId, cryptoImpl) || this;
@@ -1680,12 +1677,21 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1680
1677
  _this.logger = logger;
1681
1678
  return _this;
1682
1679
  }
1680
+ /**
1681
+ * Queue up callbacks
1682
+ * @param func - a callback function for cache change indication
1683
+ */
1684
+
1683
1685
 
1684
- var _proto = Storage.prototype;
1686
+ var _proto = NodeStorage.prototype;
1685
1687
 
1686
1688
  _proto.registerChangeEmitter = function registerChangeEmitter(func) {
1687
1689
  this.changeEmitters.push(func);
1688
- };
1690
+ }
1691
+ /**
1692
+ * Invoke the callback when cache changes
1693
+ */
1694
+ ;
1689
1695
 
1690
1696
  _proto.emitChange = function emitChange() {
1691
1697
  this.changeEmitters.forEach(function (func) {
@@ -1694,7 +1700,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1694
1700
  }
1695
1701
  /**
1696
1702
  * Converts cacheKVStore to InMemoryCache
1697
- * @param cache
1703
+ * @param cache - key value store
1698
1704
  */
1699
1705
  ;
1700
1706
 
@@ -1727,7 +1733,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1727
1733
  }
1728
1734
  /**
1729
1735
  * converts inMemoryCache to CacheKVStore
1730
- * @param inMemoryCache
1736
+ * @param inMemoryCache - kvstore map for inmemory
1731
1737
  */
1732
1738
  ;
1733
1739
 
@@ -1750,7 +1756,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1750
1756
  }
1751
1757
  /**
1752
1758
  * sets the current in memory cache for the client
1753
- * @param inMemoryCache
1759
+ * @param inMemoryCache - key value map in memory
1754
1760
  */
1755
1761
  ;
1756
1762
 
@@ -1772,7 +1778,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1772
1778
  }
1773
1779
  /**
1774
1780
  * sets the current cache (key value store)
1775
- * @param cacheMap
1781
+ * @param cacheMap - key value map
1776
1782
  */
1777
1783
  ;
1778
1784
 
@@ -1784,7 +1790,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1784
1790
  }
1785
1791
  /**
1786
1792
  * Gets cache item with given key.
1787
- * @param key
1793
+ * @param key - lookup key for the cache entry
1788
1794
  */
1789
1795
  ;
1790
1796
 
@@ -1795,9 +1801,9 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1795
1801
  return cache[key];
1796
1802
  }
1797
1803
  /**
1798
- * Gets cache item with given <key, value>
1799
- * @param key
1800
- * @param value
1804
+ * Gets cache item with given key-value
1805
+ * @param key - lookup key for the cache entry
1806
+ * @param value - value of the cache entry
1801
1807
  */
1802
1808
  ;
1803
1809
 
@@ -1811,7 +1817,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1811
1817
  }
1812
1818
  /**
1813
1819
  * fetch the account entity
1814
- * @param accountKey
1820
+ * @param accountKey - lookup key to fetch cache type AccountEntity
1815
1821
  */
1816
1822
  ;
1817
1823
 
@@ -1826,7 +1832,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1826
1832
  }
1827
1833
  /**
1828
1834
  * set account entity
1829
- * @param account
1835
+ * @param account - cache value to be set of type AccountEntity
1830
1836
  */
1831
1837
  ;
1832
1838
 
@@ -1836,7 +1842,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1836
1842
  }
1837
1843
  /**
1838
1844
  * fetch the idToken credential
1839
- * @param idTokenKey
1845
+ * @param idTokenKey - lookup key to fetch cache type IdTokenEntity
1840
1846
  */
1841
1847
  ;
1842
1848
 
@@ -1851,7 +1857,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1851
1857
  }
1852
1858
  /**
1853
1859
  * set idToken credential
1854
- * @param idToken
1860
+ * @param idToken - cache value to be set of type IdTokenEntity
1855
1861
  */
1856
1862
  ;
1857
1863
 
@@ -1861,7 +1867,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1861
1867
  }
1862
1868
  /**
1863
1869
  * fetch the accessToken credential
1864
- * @param accessTokenKey
1870
+ * @param accessTokenKey - lookup key to fetch cache type AccessTokenEntity
1865
1871
  */
1866
1872
  ;
1867
1873
 
@@ -1876,7 +1882,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1876
1882
  }
1877
1883
  /**
1878
1884
  * set accessToken credential
1879
- * @param accessToken
1885
+ * @param accessToken - cache value to be set of type AccessTokenEntity
1880
1886
  */
1881
1887
  ;
1882
1888
 
@@ -1886,7 +1892,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1886
1892
  }
1887
1893
  /**
1888
1894
  * fetch the refreshToken credential
1889
- * @param refreshTokenKey
1895
+ * @param refreshTokenKey - lookup key to fetch cache type RefreshTokenEntity
1890
1896
  */
1891
1897
  ;
1892
1898
 
@@ -1901,7 +1907,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1901
1907
  }
1902
1908
  /**
1903
1909
  * set refreshToken credential
1904
- * @param refreshToken
1910
+ * @param refreshToken - cache value to be set of type RefreshTokenEntity
1905
1911
  */
1906
1912
  ;
1907
1913
 
@@ -1911,7 +1917,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1911
1917
  }
1912
1918
  /**
1913
1919
  * fetch appMetadata entity from the platform cache
1914
- * @param appMetadataKey
1920
+ * @param appMetadataKey - lookup key to fetch cache type AppMetadataEntity
1915
1921
  */
1916
1922
  ;
1917
1923
 
@@ -1926,7 +1932,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1926
1932
  }
1927
1933
  /**
1928
1934
  * set appMetadata entity to the platform cache
1929
- * @param appMetadata
1935
+ * @param appMetadata - cache value to be set of type AppMetadataEntity
1930
1936
  */
1931
1937
  ;
1932
1938
 
@@ -1936,7 +1942,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1936
1942
  }
1937
1943
  /**
1938
1944
  * fetch server telemetry entity from the platform cache
1939
- * @param serverTelemetrykey
1945
+ * @param serverTelemetrykey - lookup key to fetch cache type ServerTelemetryEntity
1940
1946
  */
1941
1947
  ;
1942
1948
 
@@ -1951,17 +1957,54 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1951
1957
  }
1952
1958
  /**
1953
1959
  * set server telemetry entity to the platform cache
1954
- * @param serverTelemetryKey
1955
- * @param serverTelemetry
1960
+ * @param serverTelemetryKey - lookup key to fetch cache type ServerTelemetryEntity
1961
+ * @param serverTelemetry - cache value to be set of type ServerTelemetryEntity
1956
1962
  */
1957
1963
  ;
1958
1964
 
1959
1965
  _proto.setServerTelemetry = function setServerTelemetry(serverTelemetryKey, serverTelemetry) {
1960
1966
  this.setItem(serverTelemetryKey, serverTelemetry);
1961
1967
  }
1968
+ /**
1969
+ * fetch authority metadata entity from the platform cache
1970
+ * @param key - lookup key to fetch cache type AuthorityMetadataEntity
1971
+ */
1972
+ ;
1973
+
1974
+ _proto.getAuthorityMetadata = function getAuthorityMetadata(key) {
1975
+ var authorityMetadataEntity = this.getItem(key);
1976
+
1977
+ if (authorityMetadataEntity && msalCommon.AuthorityMetadataEntity.isAuthorityMetadataEntity(key, authorityMetadataEntity)) {
1978
+ return authorityMetadataEntity;
1979
+ }
1980
+
1981
+ return null;
1982
+ }
1983
+ /**
1984
+ * Get all authority metadata keys
1985
+ */
1986
+ ;
1987
+
1988
+ _proto.getAuthorityMetadataKeys = function getAuthorityMetadataKeys() {
1989
+ var _this2 = this;
1990
+
1991
+ return this.getKeys().filter(function (key) {
1992
+ return _this2.isAuthorityMetadata(key);
1993
+ });
1994
+ }
1995
+ /**
1996
+ * set authority metadata entity to the platform cache
1997
+ * @param key - lookup key to fetch cache type AuthorityMetadataEntity
1998
+ * @param metadata - cache value to be set of type AuthorityMetadataEntity
1999
+ */
2000
+ ;
2001
+
2002
+ _proto.setAuthorityMetadata = function setAuthorityMetadata(key, metadata) {
2003
+ this.setItem(key, metadata);
2004
+ }
1962
2005
  /**
1963
2006
  * fetch throttling entity from the platform cache
1964
- * @param throttlingCacheKey
2007
+ * @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
1965
2008
  */
1966
2009
  ;
1967
2010
 
@@ -1976,8 +2019,8 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1976
2019
  }
1977
2020
  /**
1978
2021
  * set throttling entity to the platform cache
1979
- * @param throttlingCacheKey
1980
- * @param throttlingCache
2022
+ * @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
2023
+ * @param throttlingCache - cache value to be set of type ThrottlingEntity
1981
2024
  */
1982
2025
  ;
1983
2026
 
@@ -1986,8 +2029,8 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1986
2029
  }
1987
2030
  /**
1988
2031
  * Removes the cache item from memory with the given key.
1989
- * @param key
1990
- * @param inMemory
2032
+ * @param key - lookup key to remove a cache entity
2033
+ * @param inMemory - key value map of the cache
1991
2034
  */
1992
2035
  ;
1993
2036
 
@@ -2012,7 +2055,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
2012
2055
  }
2013
2056
  /**
2014
2057
  * Checks whether key is in cache.
2015
- * @param key
2058
+ * @param key - look up key for a cache entity
2016
2059
  */
2017
2060
  ;
2018
2061
 
@@ -2036,37 +2079,37 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
2036
2079
  ;
2037
2080
 
2038
2081
  _proto.clear = function clear() {
2039
- var _this2 = this;
2082
+ var _this3 = this;
2040
2083
 
2041
2084
  this.logger.verbose("Clearing cache entries created by MSAL"); // read inMemoryCache
2042
2085
 
2043
2086
  var cacheKeys = this.getKeys(); // delete each element
2044
2087
 
2045
2088
  cacheKeys.forEach(function (key) {
2046
- _this2.removeItem(key);
2089
+ _this3.removeItem(key);
2047
2090
  });
2048
2091
  this.emitChange();
2049
2092
  }
2050
2093
  /**
2051
2094
  * Initialize in memory cache from an exisiting cache vault
2052
- * @param cache
2095
+ * @param cache - blob formatted cache (JSON)
2053
2096
  */
2054
2097
  ;
2055
2098
 
2056
- Storage.generateInMemoryCache = function generateInMemoryCache(cache) {
2099
+ NodeStorage.generateInMemoryCache = function generateInMemoryCache(cache) {
2057
2100
  return Deserializer.deserializeAllCache(Deserializer.deserializeJSONBlob(cache));
2058
2101
  }
2059
2102
  /**
2060
2103
  * retrieves the final JSON
2061
- * @param inMemoryCache
2104
+ * @param inMemoryCache - itemised cache read from the JSON
2062
2105
  */
2063
2106
  ;
2064
2107
 
2065
- Storage.generateJsonCache = function generateJsonCache(inMemoryCache) {
2108
+ NodeStorage.generateJsonCache = function generateJsonCache(inMemoryCache) {
2066
2109
  return Serializer.serializeAllCache(inMemoryCache);
2067
2110
  };
2068
2111
 
2069
- return Storage;
2112
+ return NodeStorage;
2070
2113
  }(msalCommon.CacheManager);
2071
2114
 
2072
2115
  var defaultSerializedCache = {
@@ -2078,6 +2121,7 @@ var defaultSerializedCache = {
2078
2121
  };
2079
2122
  /**
2080
2123
  * In-memory token cache manager
2124
+ * @public
2081
2125
  */
2082
2126
 
2083
2127
  var TokenCache = /*#__PURE__*/function () {
@@ -2123,7 +2167,7 @@ var TokenCache = /*#__PURE__*/function () {
2123
2167
  }
2124
2168
  /**
2125
2169
  * Deserializes JSON to in-memory cache. JSON should be in MSAL cache schema format
2126
- * @param cache
2170
+ * @param cache - blob formatted cache
2127
2171
  */
2128
2172
  ;
2129
2173
 
@@ -2139,6 +2183,14 @@ var TokenCache = /*#__PURE__*/function () {
2139
2183
  this.logger.verbose("No cache snapshot to deserialize");
2140
2184
  }
2141
2185
  }
2186
+ /**
2187
+ * Fetches the cache key-value map
2188
+ */
2189
+ ;
2190
+
2191
+ _proto.getKVStore = function getKVStore() {
2192
+ return this.storage.getCache();
2193
+ }
2142
2194
  /**
2143
2195
  * API that retrieves all accounts currently in cache to the user
2144
2196
  */
@@ -2200,7 +2252,7 @@ var TokenCache = /*#__PURE__*/function () {
2200
2252
  * Returns the signed in account matching homeAccountId.
2201
2253
  * (the account object is created at the time of successful login)
2202
2254
  * or null when no matching account is found
2203
- * @returns {@link AccountInfo} - the account object stored in MSAL
2255
+ * @param homeAccountId - unique identifier for an account (uid.utid)
2204
2256
  */
2205
2257
  ;
2206
2258
 
@@ -2249,7 +2301,7 @@ var TokenCache = /*#__PURE__*/function () {
2249
2301
  * Returns the signed in account matching localAccountId.
2250
2302
  * (the account object is created at the time of successful login)
2251
2303
  * or null when no matching account is found
2252
- * @returns {@link AccountInfo} - the account object stored in MSAL
2304
+ * @param localAccountId - unique identifier of an account (sub/obj when homeAccountId cannot be populated)
2253
2305
  */
2254
2306
  ;
2255
2307
 
@@ -2296,7 +2348,7 @@ var TokenCache = /*#__PURE__*/function () {
2296
2348
  }()
2297
2349
  /**
2298
2350
  * API to remove a specific account and the relevant data from cache
2299
- * @param account
2351
+ * @param account - AccountInfo passed by the user
2300
2352
  */
2301
2353
  ;
2302
2354
 
@@ -2362,8 +2414,8 @@ var TokenCache = /*#__PURE__*/function () {
2362
2414
  }
2363
2415
  /**
2364
2416
  * Merge in memory cache with the cache snapshot.
2365
- * @param oldState
2366
- * @param currentState
2417
+ * @param oldState - cache before changes
2418
+ * @param currentState - current cache state in the library
2367
2419
  */
2368
2420
  ;
2369
2421
 
@@ -2374,8 +2426,8 @@ var TokenCache = /*#__PURE__*/function () {
2374
2426
  }
2375
2427
  /**
2376
2428
  * Deep update of oldState based on newState values
2377
- * @param oldState
2378
- * @param newState
2429
+ * @param oldState - cache before changes
2430
+ * @param newState - updated cache
2379
2431
  */
2380
2432
  ;
2381
2433
 
@@ -2408,8 +2460,8 @@ var TokenCache = /*#__PURE__*/function () {
2408
2460
  /**
2409
2461
  * Removes entities in oldState that the were removed from newState. If there are any unknown values in root of
2410
2462
  * oldState that are not recognized, they are left untouched.
2411
- * @param oldState
2412
- * @param newState
2463
+ * @param oldState - cache before changes
2464
+ * @param newState - updated cache
2413
2465
  */
2414
2466
  ;
2415
2467
 
@@ -2427,7 +2479,13 @@ var TokenCache = /*#__PURE__*/function () {
2427
2479
  IdToken: idTokens,
2428
2480
  AppMetadata: appMetadata
2429
2481
  });
2430
- };
2482
+ }
2483
+ /**
2484
+ * Helper to merge new cache with the old one
2485
+ * @param oldState - cache before changes
2486
+ * @param newState - updated cache
2487
+ */
2488
+ ;
2431
2489
 
2432
2490
  _proto.mergeRemovalsDict = function mergeRemovalsDict(oldState, newState) {
2433
2491
  var finalState = _extends({}, oldState);
@@ -2438,7 +2496,12 @@ var TokenCache = /*#__PURE__*/function () {
2438
2496
  }
2439
2497
  });
2440
2498
  return finalState;
2441
- };
2499
+ }
2500
+ /**
2501
+ * Helper to overlay as a part of cache merge
2502
+ * @param passedInCache - cache read from the blob
2503
+ */
2504
+ ;
2442
2505
 
2443
2506
  _proto.overlayDefaults = function overlayDefaults(passedInCache) {
2444
2507
  this.logger.verbose("Overlaying input cache with the default cache");
@@ -2454,8 +2517,14 @@ var TokenCache = /*#__PURE__*/function () {
2454
2517
  return TokenCache;
2455
2518
  }();
2456
2519
 
2520
+ /* eslint-disable header/header */
2457
2521
  var name = "@azure/msal-node";
2458
- var version = "1.0.0-beta.2";
2522
+ var version = "1.0.0-beta.6";
2523
+
2524
+ /**
2525
+ * Base abstract class for all ClientApplications - public and confidential
2526
+ * @public
2527
+ */
2459
2528
 
2460
2529
  var ClientApplication = /*#__PURE__*/function () {
2461
2530
  /**
@@ -2465,9 +2534,8 @@ var ClientApplication = /*#__PURE__*/function () {
2465
2534
  this.config = buildAppConfiguration(configuration);
2466
2535
  this.cryptoProvider = new CryptoProvider();
2467
2536
  this.logger = new msalCommon.Logger(this.config.system.loggerOptions, name, version);
2468
- this.storage = new Storage(this.logger, this.config.auth.clientId, this.cryptoProvider);
2537
+ this.storage = new NodeStorage(this.logger, this.config.auth.clientId, this.cryptoProvider);
2469
2538
  this.tokenCache = new TokenCache(this.storage, this.logger, this.config.cache.cachePlugin);
2470
- msalCommon.TrustedAuthority.setTrustedAuthoritiesFromConfig(this.config.auth.knownAuthorities, this.config.auth.cloudDiscoveryMetadata);
2471
2539
  }
2472
2540
  /**
2473
2541
  * Creates the URL of the authorization request, letting the user input credentials and consent to the
@@ -2697,74 +2765,65 @@ var ClientApplication = /*#__PURE__*/function () {
2697
2765
  }
2698
2766
  /**
2699
2767
  * Replaces the default logger set in configurations with new Logger with new configurations
2700
- * @param logger Logger instance
2768
+ * @param logger - Logger instance
2701
2769
  */
2702
2770
  ;
2703
2771
 
2704
2772
  _proto.setLogger = function setLogger(logger) {
2705
2773
  this.logger = logger;
2706
- };
2774
+ }
2775
+ /**
2776
+ * Builds the common configuration to be passed to the common component based on the platform configurarion
2777
+ * @param authority - user passed authority in configuration
2778
+ * @param serverTelemetryManager - initializes servertelemetry if passed
2779
+ */
2780
+ ;
2707
2781
 
2708
- _proto.buildOauthClientConfiguration = /*#__PURE__*/function () {
2782
+ _proto.buildOauthClientConfiguration =
2783
+ /*#__PURE__*/
2784
+ function () {
2709
2785
  var _buildOauthClientConfiguration = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(authority, serverTelemetryManager) {
2786
+ var discoveredAuthority;
2710
2787
  return runtime_1.wrap(function _callee5$(_context5) {
2711
2788
  while (1) {
2712
2789
  switch (_context5.prev = _context5.next) {
2713
2790
  case 0:
2714
2791
  this.logger.verbose("buildOauthClientConfiguration called"); // using null assertion operator as we ensure that all config values have default values in buildConfiguration()
2715
2792
 
2716
- _context5.t0 = this.config.auth.clientId;
2717
- _context5.next = 4;
2793
+ _context5.next = 3;
2718
2794
  return this.createAuthority(authority);
2719
2795
 
2720
- case 4:
2721
- _context5.t1 = _context5.sent;
2722
- _context5.t2 = this.config.auth.knownAuthorities;
2723
- _context5.t3 = this.config.auth.cloudDiscoveryMetadata;
2724
- _context5.t4 = this.config.auth.clientCapabilities;
2725
- _context5.t5 = this.config.auth.protocolMode;
2726
- _context5.t6 = {
2727
- clientId: _context5.t0,
2728
- authority: _context5.t1,
2729
- knownAuthorities: _context5.t2,
2730
- cloudDiscoveryMetadata: _context5.t3,
2731
- clientCapabilities: _context5.t4,
2732
- protocolMode: _context5.t5
2733
- };
2734
- _context5.t7 = {
2735
- loggerCallback: this.config.system.loggerOptions.loggerCallback,
2736
- piiLoggingEnabled: this.config.system.loggerOptions.piiLoggingEnabled
2737
- };
2738
- _context5.t8 = this.cryptoProvider;
2739
- _context5.t9 = this.config.system.networkClient;
2740
- _context5.t10 = this.storage;
2741
- _context5.t11 = serverTelemetryManager;
2742
- _context5.t12 = {
2743
- clientSecret: this.clientSecret,
2744
- clientAssertion: this.clientAssertion ? this.getClientAssertion() : undefined
2745
- };
2746
- _context5.t13 = {
2747
- sku: Constants.MSAL_SKU,
2748
- version: version,
2749
- cpu: process.arch || "",
2750
- os: process.platform || ""
2751
- };
2752
- _context5.t14 = this.config.cache.cachePlugin;
2753
- _context5.t15 = this.tokenCache;
2796
+ case 3:
2797
+ discoveredAuthority = _context5.sent;
2754
2798
  return _context5.abrupt("return", {
2755
- authOptions: _context5.t6,
2756
- loggerOptions: _context5.t7,
2757
- cryptoInterface: _context5.t8,
2758
- networkInterface: _context5.t9,
2759
- storageInterface: _context5.t10,
2760
- serverTelemetryManager: _context5.t11,
2761
- clientCredentials: _context5.t12,
2762
- libraryInfo: _context5.t13,
2763
- persistencePlugin: _context5.t14,
2764
- serializableCache: _context5.t15
2799
+ authOptions: {
2800
+ clientId: this.config.auth.clientId,
2801
+ authority: discoveredAuthority,
2802
+ clientCapabilities: this.config.auth.clientCapabilities
2803
+ },
2804
+ loggerOptions: {
2805
+ loggerCallback: this.config.system.loggerOptions.loggerCallback,
2806
+ piiLoggingEnabled: this.config.system.loggerOptions.piiLoggingEnabled
2807
+ },
2808
+ cryptoInterface: this.cryptoProvider,
2809
+ networkInterface: this.config.system.networkClient,
2810
+ storageInterface: this.storage,
2811
+ serverTelemetryManager: serverTelemetryManager,
2812
+ clientCredentials: {
2813
+ clientSecret: this.clientSecret,
2814
+ clientAssertion: this.clientAssertion ? this.getClientAssertion(discoveredAuthority) : undefined
2815
+ },
2816
+ libraryInfo: {
2817
+ sku: Constants.MSAL_SKU,
2818
+ version: version,
2819
+ cpu: process.arch || "",
2820
+ os: process.platform || ""
2821
+ },
2822
+ persistencePlugin: this.config.cache.cachePlugin,
2823
+ serializableCache: this.tokenCache
2765
2824
  });
2766
2825
 
2767
- case 20:
2826
+ case 5:
2768
2827
  case "end":
2769
2828
  return _context5.stop();
2770
2829
  }
@@ -2779,26 +2838,33 @@ var ClientApplication = /*#__PURE__*/function () {
2779
2838
  return buildOauthClientConfiguration;
2780
2839
  }();
2781
2840
 
2782
- _proto.getClientAssertion = function getClientAssertion() {
2841
+ _proto.getClientAssertion = function getClientAssertion(authority) {
2783
2842
  return {
2784
- assertion: this.clientAssertion.getJwt(this.cryptoProvider, this.config.auth.clientId, this._authority.tokenEndpoint),
2843
+ assertion: this.clientAssertion.getJwt(this.cryptoProvider, this.config.auth.clientId, authority.tokenEndpoint),
2785
2844
  assertionType: Constants.JWT_BEARER_ASSERTION_TYPE
2786
2845
  };
2787
2846
  }
2788
2847
  /**
2789
2848
  * Generates a request with the default scopes & generates a correlationId.
2790
- * @param authRequest
2849
+ * @param authRequest - BaseAuthRequest for initialization
2791
2850
  */
2792
2851
  ;
2793
2852
 
2794
2853
  _proto.initializeBaseRequest = function initializeBaseRequest(authRequest) {
2795
2854
  this.logger.verbose("initializeRequestScopes called");
2796
2855
  return _extends({}, authRequest, {
2797
- scopes: [].concat(authRequest && authRequest.scopes || [], [msalCommon.Constants.OPENID_SCOPE, msalCommon.Constants.PROFILE_SCOPE, msalCommon.Constants.OFFLINE_ACCESS_SCOPE]),
2856
+ scopes: [].concat(authRequest && authRequest.scopes || [], msalCommon.OIDC_DEFAULT_SCOPES),
2798
2857
  correlationId: authRequest && authRequest.correlationId || this.cryptoProvider.createNewGuid(),
2799
2858
  authority: authRequest.authority || this.config.auth.authority
2800
2859
  });
2801
- };
2860
+ }
2861
+ /**
2862
+ * Initializes the server telemetry payload
2863
+ * @param apiId - Id for a specific request
2864
+ * @param correlationId - GUID
2865
+ * @param forceRefresh - boolean to indicate network call
2866
+ */
2867
+ ;
2802
2868
 
2803
2869
  _proto.initializeServerTelemetryManager = function initializeServerTelemetryManager(apiId, correlationId, forceRefresh) {
2804
2870
  var telemetryPayload = {
@@ -2812,7 +2878,7 @@ var ClientApplication = /*#__PURE__*/function () {
2812
2878
  /**
2813
2879
  * Create authority instance. If authority not passed in request, default to authority set on the application
2814
2880
  * object. If no authority set in application object, then default to common authority.
2815
- * @param authorityString
2881
+ * @param authorityString - authority from user configuration
2816
2882
  */
2817
2883
  ;
2818
2884
 
@@ -2820,47 +2886,30 @@ var ClientApplication = /*#__PURE__*/function () {
2820
2886
  /*#__PURE__*/
2821
2887
  function () {
2822
2888
  var _createAuthority = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(authorityString) {
2823
- var authority;
2889
+ var authorityOptions;
2824
2890
  return runtime_1.wrap(function _callee6$(_context6) {
2825
2891
  while (1) {
2826
2892
  switch (_context6.prev = _context6.next) {
2827
2893
  case 0:
2828
2894
  this.logger.verbose("createAuthority called");
2829
-
2830
- if (this.authority.canonicalAuthority !== authorityString) {
2831
- this.logger.verbose("Authority passed in, creating authority instance");
2832
- authority = msalCommon.AuthorityFactory.createInstance(authorityString, this.config.system.networkClient, this.config.auth.protocolMode);
2833
- } else {
2834
- this.logger.verbose("Authority on request is the same as on application object, defaulting to authority set on application object");
2835
- authority = this.authority;
2836
- }
2837
-
2838
- if (!authority.discoveryComplete()) {
2839
- _context6.next = 4;
2840
- break;
2841
- }
2842
-
2843
- return _context6.abrupt("return", authority);
2895
+ authorityOptions = {
2896
+ protocolMode: this.config.auth.protocolMode,
2897
+ knownAuthorities: this.config.auth.knownAuthorities,
2898
+ cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
2899
+ authorityMetadata: this.config.auth.authorityMetadata
2900
+ };
2901
+ _context6.next = 4;
2902
+ return msalCommon.AuthorityFactory.createDiscoveredInstance(authorityString, this.config.system.networkClient, this.storage, authorityOptions);
2844
2903
 
2845
2904
  case 4:
2846
- _context6.prev = 4;
2847
- _context6.next = 7;
2848
- return authority.resolveEndpointsAsync();
2849
-
2850
- case 7:
2851
- return _context6.abrupt("return", authority);
2852
-
2853
- case 10:
2854
- _context6.prev = 10;
2855
- _context6.t0 = _context6["catch"](4);
2856
- throw msalCommon.ClientAuthError.createEndpointDiscoveryIncompleteError(_context6.t0);
2905
+ return _context6.abrupt("return", _context6.sent);
2857
2906
 
2858
- case 13:
2907
+ case 5:
2859
2908
  case "end":
2860
2909
  return _context6.stop();
2861
2910
  }
2862
2911
  }
2863
- }, _callee6, this, [[4, 10]]);
2912
+ }, _callee6, this);
2864
2913
  }));
2865
2914
 
2866
2915
  function createAuthority(_x7) {
@@ -2870,24 +2919,13 @@ var ClientApplication = /*#__PURE__*/function () {
2870
2919
  return createAuthority;
2871
2920
  }();
2872
2921
 
2873
- _createClass(ClientApplication, [{
2874
- key: "authority",
2875
- get: function get() {
2876
- if (this._authority) {
2877
- return this._authority;
2878
- }
2879
-
2880
- this._authority = msalCommon.AuthorityFactory.createInstance(this.config.auth.authority, this.config.system.networkClient, this.config.auth.protocolMode);
2881
- return this._authority;
2882
- }
2883
- }]);
2884
-
2885
2922
  return ClientApplication;
2886
2923
  }();
2887
2924
 
2888
2925
  /**
2889
2926
  * This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
2890
2927
  * are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
2928
+ * @public
2891
2929
  */
2892
2930
 
2893
2931
  var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
@@ -2898,17 +2936,17 @@ var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
2898
2936
  * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal.
2899
2937
  * - authority: the authority URL for your application.
2900
2938
  *
2901
- * AAD authorities are of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}.
2939
+ * AAD authorities are of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
2902
2940
  * - 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).
2903
2941
  * - If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
2904
2942
  * - If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
2905
2943
  * - To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
2906
2944
  *
2907
- * Azure B2C authorities are of the form https://{instance}/{tenant}/{policy}. Each policy is considered
2945
+ * Azure B2C authorities are of the form https://\{instance\}/\{tenant\}/\{policy\}. Each policy is considered
2908
2946
  * its own authority. You will have to set the all of the knownAuthorities at the time of the client application
2909
2947
  * construction.
2910
2948
  *
2911
- * ADFS authorities are of the form https://{instance}/adfs.
2949
+ * ADFS authorities are of the form https://\{instance\}/adfs.
2912
2950
  */
2913
2951
  function PublicClientApplication(configuration) {
2914
2952
  return _ClientApplication.call(this, configuration) || this;
@@ -2976,7 +3014,7 @@ var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
2976
3014
  * Microsoft's documentation and recommendations are at:
2977
3015
  * https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#usernamepassword
2978
3016
  *
2979
- * @param request
3017
+ * @param request - UsenamePasswordRequest
2980
3018
  */
2981
3019
  ;
2982
3020
 
@@ -3032,16 +3070,28 @@ var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
3032
3070
  */
3033
3071
  /**
3034
3072
  * Client assertion of type jwt-bearer used in confidential client flows
3073
+ * @public
3035
3074
  */
3036
3075
 
3037
3076
  var ClientAssertion = /*#__PURE__*/function () {
3038
3077
  function ClientAssertion() {}
3039
3078
 
3079
+ /**
3080
+ * Initialize the ClientAssertion class from the clientAssertion passed by the user
3081
+ * @param assertion - refer https://tools.ietf.org/html/rfc7521
3082
+ */
3040
3083
  ClientAssertion.fromAssertion = function fromAssertion(assertion) {
3041
3084
  var clientAssertion = new ClientAssertion();
3042
3085
  clientAssertion.jwt = assertion;
3043
3086
  return clientAssertion;
3044
- };
3087
+ }
3088
+ /**
3089
+ * Initialize the ClientAssertion class from the certificate passed by the user
3090
+ * @param thumbprint - identifier of a certificate
3091
+ * @param privateKey - secret key
3092
+ * @param publicCertificate - electronic document provided to prove the ownership of the public key
3093
+ */
3094
+ ;
3045
3095
 
3046
3096
  ClientAssertion.fromCertificate = function fromCertificate(thumbprint, privateKey, publicCertificate) {
3047
3097
  var clientAssertion = new ClientAssertion();
@@ -3053,7 +3103,14 @@ var ClientAssertion = /*#__PURE__*/function () {
3053
3103
  }
3054
3104
 
3055
3105
  return clientAssertion;
3056
- };
3106
+ }
3107
+ /**
3108
+ * Update JWT for certificate based clientAssertion, if passed by the user, uses it as is
3109
+ * @param cryptoProvider - library's crypto helper
3110
+ * @param issuer - iss claim
3111
+ * @param jwtAudience - aud claim
3112
+ */
3113
+ ;
3057
3114
 
3058
3115
  var _proto = ClientAssertion.prototype;
3059
3116
 
@@ -3077,7 +3134,10 @@ var ClientAssertion = /*#__PURE__*/function () {
3077
3134
  }
3078
3135
 
3079
3136
  throw msalCommon.ClientAuthError.createInvalidAssertionError();
3080
- } // JWT format and required claims specified: https://tools.ietf.org/html/rfc7523#section-3
3137
+ }
3138
+ /**
3139
+ * JWT format and required claims specified: https://tools.ietf.org/html/rfc7523#section-3
3140
+ */
3081
3141
  ;
3082
3142
 
3083
3143
  _proto.createJwt = function createJwt(cryptoProvider, issuer, jwtAudience) {
@@ -3100,14 +3160,18 @@ var ClientAssertion = /*#__PURE__*/function () {
3100
3160
  header: header
3101
3161
  });
3102
3162
  return this.jwt;
3103
- };
3163
+ }
3164
+ /**
3165
+ * Utility API to check expiration
3166
+ */
3167
+ ;
3104
3168
 
3105
3169
  _proto.isExpired = function isExpired() {
3106
3170
  return this.expirationTime < msalCommon.TimeUtils.nowSeconds();
3107
3171
  }
3108
3172
  /**
3109
3173
  * Extracts the raw certs from a given certificate string and returns them in an array.
3110
- * @param publicCertificate
3174
+ * @param publicCertificate - electronic document provided to prove the ownership of the public key
3111
3175
  */
3112
3176
  ;
3113
3177
 
@@ -3117,15 +3181,15 @@ var ClientAssertion = /*#__PURE__*/function () {
3117
3181
  * We want to look for the contents between the BEGIN and END certificate strings, without the associated newlines.
3118
3182
  * The information in parens "(.+?)" is the capture group to represent the cert we want isolated.
3119
3183
  * "." means any string character, "+" means match 1 or more times, and "?" means the shortest match.
3120
- * The "g" at the end of the regex means search the string globally, and the "m" means search across multiple lines.
3184
+ * The "g" at the end of the regex means search the string globally, and the "s" enables the "." to match newlines.
3121
3185
  */
3122
- var regexToFindCerts = /-----BEGIN CERTIFICATE-----\n(.+?)\n-----END CERTIFICATE-----/gm;
3186
+ 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;
3123
3187
  var certs = [];
3124
3188
  var matches;
3125
3189
 
3126
3190
  while ((matches = regexToFindCerts.exec(publicCertificate)) !== null) {
3127
3191
  // matches[1] represents the first parens capture group in the regex.
3128
- certs.push(matches[1]);
3192
+ certs.push(matches[1].replace(/\n/, ""));
3129
3193
  }
3130
3194
 
3131
3195
  return certs;
@@ -3134,11 +3198,16 @@ var ClientAssertion = /*#__PURE__*/function () {
3134
3198
  return ClientAssertion;
3135
3199
  }();
3136
3200
 
3201
+ /**
3202
+ * This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
3203
+ * will configure application secrets, client certificates/assertions as applicable
3204
+ * @public
3205
+ */
3206
+
3137
3207
  var ConfidentialClientApplication = /*#__PURE__*/function (_ClientApplication) {
3138
3208
  _inheritsLoose(ConfidentialClientApplication, _ClientApplication);
3139
3209
 
3140
3210
  /**
3141
- * @constructor
3142
3211
  * Constructor for the ConfidentialClientApplication
3143
3212
  *
3144
3213
  * Required attributes in the Configuration object are:
@@ -3146,16 +3215,16 @@ var ConfidentialClientApplication = /*#__PURE__*/function (_ClientApplication) {
3146
3215
  * - authority: the authority URL for your application.
3147
3216
  * - client credential: Must set either client secret, certificate, or assertion for confidential clients. You can obtain a client secret from the application registration portal.
3148
3217
  *
3149
- * In Azure AD, authority is a URL indicating of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}.
3218
+ * In Azure AD, authority is a URL indicating of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
3150
3219
  * 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).
3151
3220
  * If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
3152
3221
  * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
3153
3222
  * To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
3154
3223
  *
3155
- * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/
3224
+ * In Azure B2C, authority is of the form https://\{instance\}/tfp/\{tenant\}/\{policyName\}/
3156
3225
  * Full B2C functionality will be available in this library in future versions.
3157
3226
  *
3158
- * @param {@link (Configuration:type)} configuration object for the MSAL ConfidentialClientApplication instance
3227
+ * @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
3159
3228
  */
3160
3229
  function ConfidentialClientApplication(configuration) {
3161
3230
  var _this;
@@ -3379,12 +3448,12 @@ Object.defineProperty(exports, 'TokenCacheContext', {
3379
3448
  return msalCommon.TokenCacheContext;
3380
3449
  }
3381
3450
  });
3451
+ exports.ClientApplication = ClientApplication;
3452
+ exports.ClientAssertion = ClientAssertion;
3382
3453
  exports.ConfidentialClientApplication = ConfidentialClientApplication;
3383
3454
  exports.CryptoProvider = CryptoProvider;
3384
- exports.Deserializer = Deserializer;
3455
+ exports.NodeStorage = NodeStorage;
3385
3456
  exports.PublicClientApplication = PublicClientApplication;
3386
- exports.Serializer = Serializer;
3387
- exports.Storage = Storage;
3388
3457
  exports.TokenCache = TokenCache;
3389
3458
  exports.buildAppConfiguration = buildAppConfiguration;
3390
3459
  //# sourceMappingURL=msal-node.cjs.development.js.map