@azure/msal-node 1.0.0-beta.5 → 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 (69) hide show
  1. package/CHANGELOG.json +33 -0
  2. package/changelog.md +12 -1
  3. package/dist/cache/ITokenCache.d.ts +9 -0
  4. package/dist/cache/ITokenCache.d.ts.map +1 -0
  5. package/dist/cache/{Storage.d.ts → NodeStorage.d.ts} +42 -33
  6. package/dist/cache/NodeStorage.d.ts.map +1 -0
  7. package/dist/cache/TokenCache.d.ts +26 -12
  8. package/dist/cache/TokenCache.d.ts.map +1 -0
  9. package/dist/cache/serializer/Deserializer.d.ts +1 -0
  10. package/dist/cache/serializer/Deserializer.d.ts.map +1 -0
  11. package/dist/cache/serializer/Serializer.d.ts +1 -0
  12. package/dist/cache/serializer/Serializer.d.ts.map +1 -0
  13. package/dist/cache/serializer/SerializerTypes.d.ts +33 -0
  14. package/dist/cache/serializer/SerializerTypes.d.ts.map +1 -0
  15. package/dist/client/ClientApplication.d.ts +36 -5
  16. package/dist/client/ClientApplication.d.ts.map +1 -0
  17. package/dist/client/ClientAssertion.d.ts +25 -1
  18. package/dist/client/ClientAssertion.d.ts.map +1 -0
  19. package/dist/client/ConfidentialClientApplication.d.ts +9 -4
  20. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -0
  21. package/dist/client/IConfidentialClientApplication.d.ts +14 -0
  22. package/dist/client/IConfidentialClientApplication.d.ts.map +1 -0
  23. package/dist/client/IPublicClientApplication.d.ts +14 -0
  24. package/dist/client/IPublicClientApplication.d.ts.map +1 -0
  25. package/dist/client/PublicClientApplication.d.ts +6 -4
  26. package/dist/client/PublicClientApplication.d.ts.map +1 -0
  27. package/dist/config/Configuration.d.ts +9 -3
  28. package/dist/config/Configuration.d.ts.map +1 -0
  29. package/dist/crypto/CryptoProvider.d.ts +10 -2
  30. package/dist/crypto/CryptoProvider.d.ts.map +1 -0
  31. package/dist/crypto/GuidGenerator.d.ts +1 -0
  32. package/dist/crypto/GuidGenerator.d.ts.map +1 -0
  33. package/dist/crypto/PkceGenerator.d.ts +1 -0
  34. package/dist/crypto/PkceGenerator.d.ts.map +1 -0
  35. package/dist/index.d.ts +9 -6
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/msal-node.cjs.development.js +186 -96
  38. package/dist/msal-node.cjs.development.js.map +1 -1
  39. package/dist/msal-node.cjs.production.min.js +1 -1
  40. package/dist/msal-node.cjs.production.min.js.map +1 -1
  41. package/dist/msal-node.esm.js +185 -95
  42. package/dist/msal-node.esm.js.map +1 -1
  43. package/dist/network/HttpClient.d.ts +1 -1
  44. package/dist/network/HttpClient.d.ts.map +1 -0
  45. package/dist/packageMetadata.d.ts +3 -0
  46. package/dist/packageMetadata.d.ts.map +1 -0
  47. package/dist/request/AuthorizationCodeRequest.d.ts +3 -1
  48. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -0
  49. package/dist/request/AuthorizationUrlRequest.d.ts +3 -1
  50. package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -0
  51. package/dist/request/ClientCredentialRequest.d.ts +3 -1
  52. package/dist/request/ClientCredentialRequest.d.ts.map +1 -0
  53. package/dist/request/DeviceCodeRequest.d.ts +3 -1
  54. package/dist/request/DeviceCodeRequest.d.ts.map +1 -0
  55. package/dist/request/OnBehalfOfRequest.d.ts +3 -1
  56. package/dist/request/OnBehalfOfRequest.d.ts.map +1 -0
  57. package/dist/request/RefreshTokenRequest.d.ts +3 -1
  58. package/dist/request/RefreshTokenRequest.d.ts.map +1 -0
  59. package/dist/request/SilentFlowRequest.d.ts +3 -1
  60. package/dist/request/SilentFlowRequest.d.ts.map +1 -0
  61. package/dist/request/UsernamePasswordRequest.d.ts +3 -1
  62. package/dist/request/UsernamePasswordRequest.d.ts.map +1 -0
  63. package/dist/utils/Constants.d.ts +1 -0
  64. package/dist/utils/Constants.d.ts.map +1 -0
  65. package/dist/utils/EncodingUtils.d.ts +1 -0
  66. package/dist/utils/EncodingUtils.d.ts.map +1 -0
  67. package/dist/utils/NetworkUtils.d.ts +1 -0
  68. package/dist/utils/NetworkUtils.d.ts.map +1 -0
  69. package/package.json +4 -3
@@ -907,20 +907,15 @@ var JwtConstants = {
907
907
  */
908
908
 
909
909
  var HttpClient = /*#__PURE__*/function () {
910
- function HttpClient() {
911
- axios.defaults.validateStatus = function () {
912
- return true;
913
- };
914
- }
910
+ function HttpClient() {}
911
+
912
+ var _proto = HttpClient.prototype;
913
+
915
914
  /**
916
915
  * Http Get request
917
916
  * @param url
918
917
  * @param options
919
918
  */
920
-
921
-
922
- var _proto = HttpClient.prototype;
923
-
924
919
  _proto.sendGetRequestAsync =
925
920
  /*#__PURE__*/
926
921
  function () {
@@ -933,7 +928,10 @@ var HttpClient = /*#__PURE__*/function () {
933
928
  request = {
934
929
  method: HttpMethod.GET,
935
930
  url: url,
936
- headers: options && options.headers
931
+ headers: options && options.headers,
932
+ validateStatus: function validateStatus() {
933
+ return true;
934
+ }
937
935
  };
938
936
  _context.next = 3;
939
937
  return axios(request);
@@ -980,7 +978,10 @@ var HttpClient = /*#__PURE__*/function () {
980
978
  method: HttpMethod.POST,
981
979
  url: url,
982
980
  data: options && options.body || "",
983
- headers: options && options.headers
981
+ headers: options && options.headers,
982
+ validateStatus: function validateStatus() {
983
+ return true;
984
+ }
984
985
  };
985
986
  _context2.next = 3;
986
987
  return axios(request);
@@ -1058,11 +1059,12 @@ var DEFAULT_SYSTEM_OPTIONS = {
1058
1059
  /**
1059
1060
  * Sets the default options when not explicitly configured from app developer
1060
1061
  *
1061
- * @param auth
1062
- * @param cache
1063
- * @param system
1062
+ * @param auth - Authentication options
1063
+ * @param cache - Cache options
1064
+ * @param system - System options
1064
1065
  *
1065
1066
  * @returns Configuration
1067
+ * @public
1066
1068
  */
1067
1069
 
1068
1070
  function buildAppConfiguration(_ref) {
@@ -1257,6 +1259,7 @@ var PkceGenerator = /*#__PURE__*/function () {
1257
1259
  /**
1258
1260
  * This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
1259
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
1260
1263
  */
1261
1264
 
1262
1265
  var CryptoProvider = /*#__PURE__*/function () {
@@ -1277,7 +1280,7 @@ var CryptoProvider = /*#__PURE__*/function () {
1277
1280
  }
1278
1281
  /**
1279
1282
  * Encodes input string to base64.
1280
- * @param input
1283
+ * @param input - string to be encoded
1281
1284
  */
1282
1285
  ;
1283
1286
 
@@ -1286,7 +1289,7 @@ var CryptoProvider = /*#__PURE__*/function () {
1286
1289
  }
1287
1290
  /**
1288
1291
  * Decodes input string from base64.
1289
- * @param input
1292
+ * @param input - string to be decoded
1290
1293
  */
1291
1294
  ;
1292
1295
 
@@ -1300,11 +1303,19 @@ var CryptoProvider = /*#__PURE__*/function () {
1300
1303
 
1301
1304
  _proto.generatePkceCodes = function generatePkceCodes() {
1302
1305
  return this.pkceGenerator.generatePkceCodes();
1303
- };
1306
+ }
1307
+ /**
1308
+ * Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
1309
+ */
1310
+ ;
1304
1311
 
1305
1312
  _proto.getPublicKeyThumbprint = function getPublicKeyThumbprint() {
1306
1313
  throw new Error("Method not implemented.");
1307
- };
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
+ ;
1308
1319
 
1309
1320
  _proto.signJwt = function signJwt() {
1310
1321
  throw new Error("Method not implemented.");
@@ -1651,12 +1662,13 @@ var Serializer = /*#__PURE__*/function () {
1651
1662
 
1652
1663
  /**
1653
1664
  * This class implements Storage for node, reading cache from user specified storage location or an extension library
1665
+ * @public
1654
1666
  */
1655
1667
 
1656
- var Storage = /*#__PURE__*/function (_CacheManager) {
1657
- _inheritsLoose(Storage, _CacheManager);
1668
+ var NodeStorage = /*#__PURE__*/function (_CacheManager) {
1669
+ _inheritsLoose(NodeStorage, _CacheManager);
1658
1670
 
1659
- function Storage(logger, clientId, cryptoImpl) {
1671
+ function NodeStorage(logger, clientId, cryptoImpl) {
1660
1672
  var _this;
1661
1673
 
1662
1674
  _this = _CacheManager.call(this, clientId, cryptoImpl) || this;
@@ -1665,12 +1677,21 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1665
1677
  _this.logger = logger;
1666
1678
  return _this;
1667
1679
  }
1680
+ /**
1681
+ * Queue up callbacks
1682
+ * @param func - a callback function for cache change indication
1683
+ */
1668
1684
 
1669
- var _proto = Storage.prototype;
1685
+
1686
+ var _proto = NodeStorage.prototype;
1670
1687
 
1671
1688
  _proto.registerChangeEmitter = function registerChangeEmitter(func) {
1672
1689
  this.changeEmitters.push(func);
1673
- };
1690
+ }
1691
+ /**
1692
+ * Invoke the callback when cache changes
1693
+ */
1694
+ ;
1674
1695
 
1675
1696
  _proto.emitChange = function emitChange() {
1676
1697
  this.changeEmitters.forEach(function (func) {
@@ -1679,7 +1700,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1679
1700
  }
1680
1701
  /**
1681
1702
  * Converts cacheKVStore to InMemoryCache
1682
- * @param cache
1703
+ * @param cache - key value store
1683
1704
  */
1684
1705
  ;
1685
1706
 
@@ -1712,7 +1733,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1712
1733
  }
1713
1734
  /**
1714
1735
  * converts inMemoryCache to CacheKVStore
1715
- * @param inMemoryCache
1736
+ * @param inMemoryCache - kvstore map for inmemory
1716
1737
  */
1717
1738
  ;
1718
1739
 
@@ -1735,7 +1756,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1735
1756
  }
1736
1757
  /**
1737
1758
  * sets the current in memory cache for the client
1738
- * @param inMemoryCache
1759
+ * @param inMemoryCache - key value map in memory
1739
1760
  */
1740
1761
  ;
1741
1762
 
@@ -1757,7 +1778,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1757
1778
  }
1758
1779
  /**
1759
1780
  * sets the current cache (key value store)
1760
- * @param cacheMap
1781
+ * @param cacheMap - key value map
1761
1782
  */
1762
1783
  ;
1763
1784
 
@@ -1769,7 +1790,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1769
1790
  }
1770
1791
  /**
1771
1792
  * Gets cache item with given key.
1772
- * @param key
1793
+ * @param key - lookup key for the cache entry
1773
1794
  */
1774
1795
  ;
1775
1796
 
@@ -1780,9 +1801,9 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1780
1801
  return cache[key];
1781
1802
  }
1782
1803
  /**
1783
- * Gets cache item with given <key, value>
1784
- * @param key
1785
- * @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
1786
1807
  */
1787
1808
  ;
1788
1809
 
@@ -1796,7 +1817,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1796
1817
  }
1797
1818
  /**
1798
1819
  * fetch the account entity
1799
- * @param accountKey
1820
+ * @param accountKey - lookup key to fetch cache type AccountEntity
1800
1821
  */
1801
1822
  ;
1802
1823
 
@@ -1811,7 +1832,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1811
1832
  }
1812
1833
  /**
1813
1834
  * set account entity
1814
- * @param account
1835
+ * @param account - cache value to be set of type AccountEntity
1815
1836
  */
1816
1837
  ;
1817
1838
 
@@ -1821,7 +1842,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1821
1842
  }
1822
1843
  /**
1823
1844
  * fetch the idToken credential
1824
- * @param idTokenKey
1845
+ * @param idTokenKey - lookup key to fetch cache type IdTokenEntity
1825
1846
  */
1826
1847
  ;
1827
1848
 
@@ -1836,7 +1857,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1836
1857
  }
1837
1858
  /**
1838
1859
  * set idToken credential
1839
- * @param idToken
1860
+ * @param idToken - cache value to be set of type IdTokenEntity
1840
1861
  */
1841
1862
  ;
1842
1863
 
@@ -1846,7 +1867,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1846
1867
  }
1847
1868
  /**
1848
1869
  * fetch the accessToken credential
1849
- * @param accessTokenKey
1870
+ * @param accessTokenKey - lookup key to fetch cache type AccessTokenEntity
1850
1871
  */
1851
1872
  ;
1852
1873
 
@@ -1861,7 +1882,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1861
1882
  }
1862
1883
  /**
1863
1884
  * set accessToken credential
1864
- * @param accessToken
1885
+ * @param accessToken - cache value to be set of type AccessTokenEntity
1865
1886
  */
1866
1887
  ;
1867
1888
 
@@ -1871,7 +1892,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1871
1892
  }
1872
1893
  /**
1873
1894
  * fetch the refreshToken credential
1874
- * @param refreshTokenKey
1895
+ * @param refreshTokenKey - lookup key to fetch cache type RefreshTokenEntity
1875
1896
  */
1876
1897
  ;
1877
1898
 
@@ -1886,7 +1907,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1886
1907
  }
1887
1908
  /**
1888
1909
  * set refreshToken credential
1889
- * @param refreshToken
1910
+ * @param refreshToken - cache value to be set of type RefreshTokenEntity
1890
1911
  */
1891
1912
  ;
1892
1913
 
@@ -1896,7 +1917,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1896
1917
  }
1897
1918
  /**
1898
1919
  * fetch appMetadata entity from the platform cache
1899
- * @param appMetadataKey
1920
+ * @param appMetadataKey - lookup key to fetch cache type AppMetadataEntity
1900
1921
  */
1901
1922
  ;
1902
1923
 
@@ -1911,7 +1932,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1911
1932
  }
1912
1933
  /**
1913
1934
  * set appMetadata entity to the platform cache
1914
- * @param appMetadata
1935
+ * @param appMetadata - cache value to be set of type AppMetadataEntity
1915
1936
  */
1916
1937
  ;
1917
1938
 
@@ -1921,7 +1942,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1921
1942
  }
1922
1943
  /**
1923
1944
  * fetch server telemetry entity from the platform cache
1924
- * @param serverTelemetrykey
1945
+ * @param serverTelemetrykey - lookup key to fetch cache type ServerTelemetryEntity
1925
1946
  */
1926
1947
  ;
1927
1948
 
@@ -1936,8 +1957,8 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1936
1957
  }
1937
1958
  /**
1938
1959
  * set server telemetry entity to the platform cache
1939
- * @param serverTelemetryKey
1940
- * @param serverTelemetry
1960
+ * @param serverTelemetryKey - lookup key to fetch cache type ServerTelemetryEntity
1961
+ * @param serverTelemetry - cache value to be set of type ServerTelemetryEntity
1941
1962
  */
1942
1963
  ;
1943
1964
 
@@ -1946,7 +1967,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1946
1967
  }
1947
1968
  /**
1948
1969
  * fetch authority metadata entity from the platform cache
1949
- * @param key
1970
+ * @param key - lookup key to fetch cache type AuthorityMetadataEntity
1950
1971
  */
1951
1972
  ;
1952
1973
 
@@ -1973,8 +1994,8 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1973
1994
  }
1974
1995
  /**
1975
1996
  * set authority metadata entity to the platform cache
1976
- * @param key
1977
- * @param metadata
1997
+ * @param key - lookup key to fetch cache type AuthorityMetadataEntity
1998
+ * @param metadata - cache value to be set of type AuthorityMetadataEntity
1978
1999
  */
1979
2000
  ;
1980
2001
 
@@ -1983,7 +2004,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1983
2004
  }
1984
2005
  /**
1985
2006
  * fetch throttling entity from the platform cache
1986
- * @param throttlingCacheKey
2007
+ * @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
1987
2008
  */
1988
2009
  ;
1989
2010
 
@@ -1998,8 +2019,8 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
1998
2019
  }
1999
2020
  /**
2000
2021
  * set throttling entity to the platform cache
2001
- * @param throttlingCacheKey
2002
- * @param throttlingCache
2022
+ * @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
2023
+ * @param throttlingCache - cache value to be set of type ThrottlingEntity
2003
2024
  */
2004
2025
  ;
2005
2026
 
@@ -2008,8 +2029,8 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
2008
2029
  }
2009
2030
  /**
2010
2031
  * Removes the cache item from memory with the given key.
2011
- * @param key
2012
- * @param inMemory
2032
+ * @param key - lookup key to remove a cache entity
2033
+ * @param inMemory - key value map of the cache
2013
2034
  */
2014
2035
  ;
2015
2036
 
@@ -2034,7 +2055,7 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
2034
2055
  }
2035
2056
  /**
2036
2057
  * Checks whether key is in cache.
2037
- * @param key
2058
+ * @param key - look up key for a cache entity
2038
2059
  */
2039
2060
  ;
2040
2061
 
@@ -2071,24 +2092,24 @@ var Storage = /*#__PURE__*/function (_CacheManager) {
2071
2092
  }
2072
2093
  /**
2073
2094
  * Initialize in memory cache from an exisiting cache vault
2074
- * @param cache
2095
+ * @param cache - blob formatted cache (JSON)
2075
2096
  */
2076
2097
  ;
2077
2098
 
2078
- Storage.generateInMemoryCache = function generateInMemoryCache(cache) {
2099
+ NodeStorage.generateInMemoryCache = function generateInMemoryCache(cache) {
2079
2100
  return Deserializer.deserializeAllCache(Deserializer.deserializeJSONBlob(cache));
2080
2101
  }
2081
2102
  /**
2082
2103
  * retrieves the final JSON
2083
- * @param inMemoryCache
2104
+ * @param inMemoryCache - itemised cache read from the JSON
2084
2105
  */
2085
2106
  ;
2086
2107
 
2087
- Storage.generateJsonCache = function generateJsonCache(inMemoryCache) {
2108
+ NodeStorage.generateJsonCache = function generateJsonCache(inMemoryCache) {
2088
2109
  return Serializer.serializeAllCache(inMemoryCache);
2089
2110
  };
2090
2111
 
2091
- return Storage;
2112
+ return NodeStorage;
2092
2113
  }(msalCommon.CacheManager);
2093
2114
 
2094
2115
  var defaultSerializedCache = {
@@ -2100,6 +2121,7 @@ var defaultSerializedCache = {
2100
2121
  };
2101
2122
  /**
2102
2123
  * In-memory token cache manager
2124
+ * @public
2103
2125
  */
2104
2126
 
2105
2127
  var TokenCache = /*#__PURE__*/function () {
@@ -2145,7 +2167,7 @@ var TokenCache = /*#__PURE__*/function () {
2145
2167
  }
2146
2168
  /**
2147
2169
  * Deserializes JSON to in-memory cache. JSON should be in MSAL cache schema format
2148
- * @param cache
2170
+ * @param cache - blob formatted cache
2149
2171
  */
2150
2172
  ;
2151
2173
 
@@ -2160,7 +2182,11 @@ var TokenCache = /*#__PURE__*/function () {
2160
2182
  } else {
2161
2183
  this.logger.verbose("No cache snapshot to deserialize");
2162
2184
  }
2163
- };
2185
+ }
2186
+ /**
2187
+ * Fetches the cache key-value map
2188
+ */
2189
+ ;
2164
2190
 
2165
2191
  _proto.getKVStore = function getKVStore() {
2166
2192
  return this.storage.getCache();
@@ -2226,7 +2252,7 @@ var TokenCache = /*#__PURE__*/function () {
2226
2252
  * Returns the signed in account matching homeAccountId.
2227
2253
  * (the account object is created at the time of successful login)
2228
2254
  * or null when no matching account is found
2229
- * @returns {@link AccountInfo} - the account object stored in MSAL
2255
+ * @param homeAccountId - unique identifier for an account (uid.utid)
2230
2256
  */
2231
2257
  ;
2232
2258
 
@@ -2275,7 +2301,7 @@ var TokenCache = /*#__PURE__*/function () {
2275
2301
  * Returns the signed in account matching localAccountId.
2276
2302
  * (the account object is created at the time of successful login)
2277
2303
  * or null when no matching account is found
2278
- * @returns {@link AccountInfo} - the account object stored in MSAL
2304
+ * @param localAccountId - unique identifier of an account (sub/obj when homeAccountId cannot be populated)
2279
2305
  */
2280
2306
  ;
2281
2307
 
@@ -2322,7 +2348,7 @@ var TokenCache = /*#__PURE__*/function () {
2322
2348
  }()
2323
2349
  /**
2324
2350
  * API to remove a specific account and the relevant data from cache
2325
- * @param account
2351
+ * @param account - AccountInfo passed by the user
2326
2352
  */
2327
2353
  ;
2328
2354
 
@@ -2388,8 +2414,8 @@ var TokenCache = /*#__PURE__*/function () {
2388
2414
  }
2389
2415
  /**
2390
2416
  * Merge in memory cache with the cache snapshot.
2391
- * @param oldState
2392
- * @param currentState
2417
+ * @param oldState - cache before changes
2418
+ * @param currentState - current cache state in the library
2393
2419
  */
2394
2420
  ;
2395
2421
 
@@ -2400,8 +2426,8 @@ var TokenCache = /*#__PURE__*/function () {
2400
2426
  }
2401
2427
  /**
2402
2428
  * Deep update of oldState based on newState values
2403
- * @param oldState
2404
- * @param newState
2429
+ * @param oldState - cache before changes
2430
+ * @param newState - updated cache
2405
2431
  */
2406
2432
  ;
2407
2433
 
@@ -2434,8 +2460,8 @@ var TokenCache = /*#__PURE__*/function () {
2434
2460
  /**
2435
2461
  * Removes entities in oldState that the were removed from newState. If there are any unknown values in root of
2436
2462
  * oldState that are not recognized, they are left untouched.
2437
- * @param oldState
2438
- * @param newState
2463
+ * @param oldState - cache before changes
2464
+ * @param newState - updated cache
2439
2465
  */
2440
2466
  ;
2441
2467
 
@@ -2453,7 +2479,13 @@ var TokenCache = /*#__PURE__*/function () {
2453
2479
  IdToken: idTokens,
2454
2480
  AppMetadata: appMetadata
2455
2481
  });
2456
- };
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
+ ;
2457
2489
 
2458
2490
  _proto.mergeRemovalsDict = function mergeRemovalsDict(oldState, newState) {
2459
2491
  var finalState = _extends({}, oldState);
@@ -2464,7 +2496,12 @@ var TokenCache = /*#__PURE__*/function () {
2464
2496
  }
2465
2497
  });
2466
2498
  return finalState;
2467
- };
2499
+ }
2500
+ /**
2501
+ * Helper to overlay as a part of cache merge
2502
+ * @param passedInCache - cache read from the blob
2503
+ */
2504
+ ;
2468
2505
 
2469
2506
  _proto.overlayDefaults = function overlayDefaults(passedInCache) {
2470
2507
  this.logger.verbose("Overlaying input cache with the default cache");
@@ -2480,8 +2517,14 @@ var TokenCache = /*#__PURE__*/function () {
2480
2517
  return TokenCache;
2481
2518
  }();
2482
2519
 
2520
+ /* eslint-disable header/header */
2483
2521
  var name = "@azure/msal-node";
2484
- var version = "1.0.0-beta.5";
2522
+ var version = "1.0.0-beta.6";
2523
+
2524
+ /**
2525
+ * Base abstract class for all ClientApplications - public and confidential
2526
+ * @public
2527
+ */
2485
2528
 
2486
2529
  var ClientApplication = /*#__PURE__*/function () {
2487
2530
  /**
@@ -2491,7 +2534,7 @@ var ClientApplication = /*#__PURE__*/function () {
2491
2534
  this.config = buildAppConfiguration(configuration);
2492
2535
  this.cryptoProvider = new CryptoProvider();
2493
2536
  this.logger = new msalCommon.Logger(this.config.system.loggerOptions, name, version);
2494
- 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);
2495
2538
  this.tokenCache = new TokenCache(this.storage, this.logger, this.config.cache.cachePlugin);
2496
2539
  }
2497
2540
  /**
@@ -2722,15 +2765,23 @@ var ClientApplication = /*#__PURE__*/function () {
2722
2765
  }
2723
2766
  /**
2724
2767
  * Replaces the default logger set in configurations with new Logger with new configurations
2725
- * @param logger Logger instance
2768
+ * @param logger - Logger instance
2726
2769
  */
2727
2770
  ;
2728
2771
 
2729
2772
  _proto.setLogger = function setLogger(logger) {
2730
2773
  this.logger = logger;
2731
- };
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
+ ;
2732
2781
 
2733
- _proto.buildOauthClientConfiguration = /*#__PURE__*/function () {
2782
+ _proto.buildOauthClientConfiguration =
2783
+ /*#__PURE__*/
2784
+ function () {
2734
2785
  var _buildOauthClientConfiguration = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(authority, serverTelemetryManager) {
2735
2786
  var discoveredAuthority;
2736
2787
  return runtime_1.wrap(function _callee5$(_context5) {
@@ -2795,18 +2846,25 @@ var ClientApplication = /*#__PURE__*/function () {
2795
2846
  }
2796
2847
  /**
2797
2848
  * Generates a request with the default scopes & generates a correlationId.
2798
- * @param authRequest
2849
+ * @param authRequest - BaseAuthRequest for initialization
2799
2850
  */
2800
2851
  ;
2801
2852
 
2802
2853
  _proto.initializeBaseRequest = function initializeBaseRequest(authRequest) {
2803
2854
  this.logger.verbose("initializeRequestScopes called");
2804
2855
  return _extends({}, authRequest, {
2805
- 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),
2806
2857
  correlationId: authRequest && authRequest.correlationId || this.cryptoProvider.createNewGuid(),
2807
2858
  authority: authRequest.authority || this.config.auth.authority
2808
2859
  });
2809
- };
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
+ ;
2810
2868
 
2811
2869
  _proto.initializeServerTelemetryManager = function initializeServerTelemetryManager(apiId, correlationId, forceRefresh) {
2812
2870
  var telemetryPayload = {
@@ -2820,7 +2878,7 @@ var ClientApplication = /*#__PURE__*/function () {
2820
2878
  /**
2821
2879
  * Create authority instance. If authority not passed in request, default to authority set on the application
2822
2880
  * object. If no authority set in application object, then default to common authority.
2823
- * @param authorityString
2881
+ * @param authorityString - authority from user configuration
2824
2882
  */
2825
2883
  ;
2826
2884
 
@@ -2867,6 +2925,7 @@ var ClientApplication = /*#__PURE__*/function () {
2867
2925
  /**
2868
2926
  * This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
2869
2927
  * are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
2928
+ * @public
2870
2929
  */
2871
2930
 
2872
2931
  var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
@@ -2877,17 +2936,17 @@ var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
2877
2936
  * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal.
2878
2937
  * - authority: the authority URL for your application.
2879
2938
  *
2880
- * 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\}.
2881
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).
2882
2941
  * - If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
2883
2942
  * - If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
2884
2943
  * - To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
2885
2944
  *
2886
- * 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
2887
2946
  * its own authority. You will have to set the all of the knownAuthorities at the time of the client application
2888
2947
  * construction.
2889
2948
  *
2890
- * ADFS authorities are of the form https://{instance}/adfs.
2949
+ * ADFS authorities are of the form https://\{instance\}/adfs.
2891
2950
  */
2892
2951
  function PublicClientApplication(configuration) {
2893
2952
  return _ClientApplication.call(this, configuration) || this;
@@ -2955,7 +3014,7 @@ var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
2955
3014
  * Microsoft's documentation and recommendations are at:
2956
3015
  * https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#usernamepassword
2957
3016
  *
2958
- * @param request
3017
+ * @param request - UsenamePasswordRequest
2959
3018
  */
2960
3019
  ;
2961
3020
 
@@ -3011,16 +3070,28 @@ var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
3011
3070
  */
3012
3071
  /**
3013
3072
  * Client assertion of type jwt-bearer used in confidential client flows
3073
+ * @public
3014
3074
  */
3015
3075
 
3016
3076
  var ClientAssertion = /*#__PURE__*/function () {
3017
3077
  function ClientAssertion() {}
3018
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
+ */
3019
3083
  ClientAssertion.fromAssertion = function fromAssertion(assertion) {
3020
3084
  var clientAssertion = new ClientAssertion();
3021
3085
  clientAssertion.jwt = assertion;
3022
3086
  return clientAssertion;
3023
- };
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
+ ;
3024
3095
 
3025
3096
  ClientAssertion.fromCertificate = function fromCertificate(thumbprint, privateKey, publicCertificate) {
3026
3097
  var clientAssertion = new ClientAssertion();
@@ -3032,7 +3103,14 @@ var ClientAssertion = /*#__PURE__*/function () {
3032
3103
  }
3033
3104
 
3034
3105
  return clientAssertion;
3035
- };
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
+ ;
3036
3114
 
3037
3115
  var _proto = ClientAssertion.prototype;
3038
3116
 
@@ -3056,7 +3134,10 @@ var ClientAssertion = /*#__PURE__*/function () {
3056
3134
  }
3057
3135
 
3058
3136
  throw msalCommon.ClientAuthError.createInvalidAssertionError();
3059
- } // 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
+ */
3060
3141
  ;
3061
3142
 
3062
3143
  _proto.createJwt = function createJwt(cryptoProvider, issuer, jwtAudience) {
@@ -3079,14 +3160,18 @@ var ClientAssertion = /*#__PURE__*/function () {
3079
3160
  header: header
3080
3161
  });
3081
3162
  return this.jwt;
3082
- };
3163
+ }
3164
+ /**
3165
+ * Utility API to check expiration
3166
+ */
3167
+ ;
3083
3168
 
3084
3169
  _proto.isExpired = function isExpired() {
3085
3170
  return this.expirationTime < msalCommon.TimeUtils.nowSeconds();
3086
3171
  }
3087
3172
  /**
3088
3173
  * Extracts the raw certs from a given certificate string and returns them in an array.
3089
- * @param publicCertificate
3174
+ * @param publicCertificate - electronic document provided to prove the ownership of the public key
3090
3175
  */
3091
3176
  ;
3092
3177
 
@@ -3113,11 +3198,16 @@ var ClientAssertion = /*#__PURE__*/function () {
3113
3198
  return ClientAssertion;
3114
3199
  }();
3115
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
+
3116
3207
  var ConfidentialClientApplication = /*#__PURE__*/function (_ClientApplication) {
3117
3208
  _inheritsLoose(ConfidentialClientApplication, _ClientApplication);
3118
3209
 
3119
3210
  /**
3120
- * @constructor
3121
3211
  * Constructor for the ConfidentialClientApplication
3122
3212
  *
3123
3213
  * Required attributes in the Configuration object are:
@@ -3125,16 +3215,16 @@ var ConfidentialClientApplication = /*#__PURE__*/function (_ClientApplication) {
3125
3215
  * - authority: the authority URL for your application.
3126
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.
3127
3217
  *
3128
- * 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\}.
3129
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).
3130
3220
  * If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
3131
3221
  * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
3132
3222
  * To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
3133
3223
  *
3134
- * 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\}/
3135
3225
  * Full B2C functionality will be available in this library in future versions.
3136
3226
  *
3137
- * @param {@link (Configuration:type)} configuration object for the MSAL ConfidentialClientApplication instance
3227
+ * @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
3138
3228
  */
3139
3229
  function ConfidentialClientApplication(configuration) {
3140
3230
  var _this;
@@ -3358,12 +3448,12 @@ Object.defineProperty(exports, 'TokenCacheContext', {
3358
3448
  return msalCommon.TokenCacheContext;
3359
3449
  }
3360
3450
  });
3451
+ exports.ClientApplication = ClientApplication;
3452
+ exports.ClientAssertion = ClientAssertion;
3361
3453
  exports.ConfidentialClientApplication = ConfidentialClientApplication;
3362
3454
  exports.CryptoProvider = CryptoProvider;
3363
- exports.Deserializer = Deserializer;
3455
+ exports.NodeStorage = NodeStorage;
3364
3456
  exports.PublicClientApplication = PublicClientApplication;
3365
- exports.Serializer = Serializer;
3366
- exports.Storage = Storage;
3367
3457
  exports.TokenCache = TokenCache;
3368
3458
  exports.buildAppConfiguration = buildAppConfiguration;
3369
3459
  //# sourceMappingURL=msal-node.cjs.development.js.map