@inrupt/solid-client-authn-browser 1.11.9-alpha.1 → 1.11.9-alpha.4

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 (262) hide show
  1. package/dist/index.es.js +4 -352
  2. package/dist/index.es.js.map +1 -0
  3. package/dist/index.js +12 -360
  4. package/dist/index.js.map +1 -1
  5. package/dist/solid-client-authn.bundle.js +14 -363
  6. package/dist/solid-client-authn.bundle.js.map +1 -0
  7. package/package.json +8 -5
  8. package/.eslintrc.js +0 -16
  9. package/NOTICE +0 -5
  10. package/coverage/clover.xml +0 -547
  11. package/coverage/coverage-final.json +0 -28
  12. package/coverage/lcov-report/base.css +0 -224
  13. package/coverage/lcov-report/block-navigation.js +0 -87
  14. package/coverage/lcov-report/favicon.png +0 -0
  15. package/coverage/lcov-report/index.html +0 -266
  16. package/coverage/lcov-report/prettify.css +0 -1
  17. package/coverage/lcov-report/prettify.js +0 -2
  18. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  19. package/coverage/lcov-report/sorter.js +0 -196
  20. package/coverage/lcov-report/src/ClientAuthentication.ts.html +0 -631
  21. package/coverage/lcov-report/src/Session.ts.html +0 -1435
  22. package/coverage/lcov-report/src/constant.ts.html +0 -163
  23. package/coverage/lcov-report/src/defaultSession.ts.html +0 -460
  24. package/coverage/lcov-report/src/dependencies.ts.html +0 -400
  25. package/coverage/lcov-report/src/iframe.ts.html +0 -394
  26. package/coverage/lcov-report/src/index.browser.ts.html +0 -157
  27. package/coverage/lcov-report/src/index.html +0 -206
  28. package/coverage/lcov-report/src/login/AggregateLoginHandler.ts.html +0 -226
  29. package/coverage/lcov-report/src/login/index.html +0 -116
  30. package/coverage/lcov-report/src/login/oidc/AggregateOidcHandler.ts.html +0 -226
  31. package/coverage/lcov-report/src/login/oidc/ClientRegistrar.ts.html +0 -415
  32. package/coverage/lcov-report/src/login/oidc/IssuerConfigFetcher.ts.html +0 -646
  33. package/coverage/lcov-report/src/login/oidc/OidcLoginHandler.ts.html +0 -436
  34. package/coverage/lcov-report/src/login/oidc/Redirector.ts.html +0 -229
  35. package/coverage/lcov-report/src/login/oidc/index.html +0 -176
  36. package/coverage/lcov-report/src/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.ts.html +0 -478
  37. package/coverage/lcov-report/src/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.ts.html +0 -319
  38. package/coverage/lcov-report/src/login/oidc/oidcHandlers/index.html +0 -131
  39. package/coverage/lcov-report/src/login/oidc/redirectHandler/AggregateRedirectHandler.ts.html +0 -226
  40. package/coverage/lcov-report/src/login/oidc/redirectHandler/AuthCodeRedirectHandler.ts.html +0 -667
  41. package/coverage/lcov-report/src/login/oidc/redirectHandler/ErrorOidcHandler.ts.html +0 -283
  42. package/coverage/lcov-report/src/login/oidc/redirectHandler/FallbackRedirectHandler.ts.html +0 -265
  43. package/coverage/lcov-report/src/login/oidc/redirectHandler/index.html +0 -161
  44. package/coverage/lcov-report/src/login/oidc/refresh/TokenRefresher.ts.html +0 -385
  45. package/coverage/lcov-report/src/login/oidc/refresh/index.html +0 -116
  46. package/coverage/lcov-report/src/login/webid/WebIdLoginHandler.ts.html +0 -250
  47. package/coverage/lcov-report/src/login/webid/index.html +0 -116
  48. package/coverage/lcov-report/src/logout/GeneralLogoutHandler.ts.html +0 -220
  49. package/coverage/lcov-report/src/logout/index.html +0 -116
  50. package/coverage/lcov-report/src/sessionInfo/SessionInfoManager.ts.html +0 -775
  51. package/coverage/lcov-report/src/sessionInfo/index.html +0 -116
  52. package/coverage/lcov-report/src/storage/BrowserStorage.ts.html +0 -229
  53. package/coverage/lcov-report/src/storage/StorageUtility.ts.html +0 -214
  54. package/coverage/lcov-report/src/storage/index.html +0 -131
  55. package/coverage/lcov-report/src/util/UuidGenerator.ts.html +0 -226
  56. package/coverage/lcov-report/src/util/index.html +0 -131
  57. package/coverage/lcov-report/src/util/urlPath.ts.html +0 -208
  58. package/coverage/lcov.info +0 -1001
  59. package/dist/ClientAuthentication.js +0 -64
  60. package/dist/ClientAuthentication.js.map +0 -1
  61. package/dist/Session.js +0 -165
  62. package/dist/Session.js.map +0 -1
  63. package/dist/constant.js +0 -7
  64. package/dist/constant.js.map +0 -1
  65. package/dist/defaultSession.js +0 -48
  66. package/dist/defaultSession.js.map +0 -1
  67. package/dist/dependencies.js +0 -41
  68. package/dist/dependencies.js.map +0 -1
  69. package/dist/iframe.js +0 -43
  70. package/dist/iframe.js.map +0 -1
  71. package/dist/index.browser.d.ts +0 -1
  72. package/dist/index.browser.js +0 -28
  73. package/dist/index.browser.js.map +0 -1
  74. package/dist/login/AggregateLoginHandler.js +0 -10
  75. package/dist/login/AggregateLoginHandler.js.map +0 -1
  76. package/dist/login/oidc/AggregateOidcHandler.js +0 -10
  77. package/dist/login/oidc/AggregateOidcHandler.js.map +0 -1
  78. package/dist/login/oidc/ClientRegistrar.js +0 -51
  79. package/dist/login/oidc/ClientRegistrar.js.map +0 -1
  80. package/dist/login/oidc/IssuerConfigFetcher.js +0 -124
  81. package/dist/login/oidc/IssuerConfigFetcher.js.map +0 -1
  82. package/dist/login/oidc/OidcLoginHandler.js +0 -40
  83. package/dist/login/oidc/OidcLoginHandler.js.map +0 -1
  84. package/dist/login/oidc/Redirector.js +0 -21
  85. package/dist/login/oidc/Redirector.js.map +0 -1
  86. package/dist/login/oidc/__mocks__/IOidcOptions.d.ts +0 -2
  87. package/dist/login/oidc/__mocks__/IOidcOptions.js +0 -25
  88. package/dist/login/oidc/__mocks__/IOidcOptions.js.map +0 -1
  89. package/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js +0 -56
  90. package/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js.map +0 -1
  91. package/dist/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.js +0 -47
  92. package/dist/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.js.map +0 -1
  93. package/dist/login/oidc/redirectHandler/AggregateRedirectHandler.js +0 -10
  94. package/dist/login/oidc/redirectHandler/AggregateRedirectHandler.js.map +0 -1
  95. package/dist/login/oidc/redirectHandler/AuthCodeRedirectHandler.js +0 -92
  96. package/dist/login/oidc/redirectHandler/AuthCodeRedirectHandler.js.map +0 -1
  97. package/dist/login/oidc/redirectHandler/ErrorOidcHandler.js +0 -26
  98. package/dist/login/oidc/redirectHandler/ErrorOidcHandler.js.map +0 -1
  99. package/dist/login/oidc/redirectHandler/FallbackRedirectHandler.js +0 -20
  100. package/dist/login/oidc/redirectHandler/FallbackRedirectHandler.js.map +0 -1
  101. package/dist/login/oidc/refresh/TokenRefresher.js +0 -31
  102. package/dist/login/oidc/refresh/TokenRefresher.js.map +0 -1
  103. package/dist/login/webid/WebIdLoginHandler.js +0 -12
  104. package/dist/login/webid/WebIdLoginHandler.js.map +0 -1
  105. package/dist/logout/GeneralLogoutHandler.js +0 -15
  106. package/dist/logout/GeneralLogoutHandler.js.map +0 -1
  107. package/dist/sessionInfo/SessionInfoManager.js +0 -95
  108. package/dist/sessionInfo/SessionInfoManager.js.map +0 -1
  109. package/dist/solid-client-authn.bundle.js.LICENSE.txt +0 -17
  110. package/dist/storage/BrowserStorage.js +0 -18
  111. package/dist/storage/BrowserStorage.js.map +0 -1
  112. package/dist/storage/StorageUtility.js +0 -10
  113. package/dist/storage/StorageUtility.js.map +0 -1
  114. package/dist/util/UuidGenerator.js +0 -10
  115. package/dist/util/UuidGenerator.js.map +0 -1
  116. package/dist/util/urlPath.js +0 -11
  117. package/dist/util/urlPath.js.map +0 -1
  118. package/docs/api/Makefile +0 -76
  119. package/docs/api/README.md +0 -46
  120. package/docs/api/build/docs-assets/README.md +0 -183
  121. package/docs/api/build/docs-assets/_static/css/inrupt.css +0 -349
  122. package/docs/api/build/docs-assets/_templates/breadcrumb-navigation.html +0 -10
  123. package/docs/api/build/docs-assets/_templates/copyright.html +0 -3
  124. package/docs/api/build/docs-assets/_templates/docs-sidebar.html +0 -32
  125. package/docs/api/build/docs-assets/_templates/docs-version-selector.html +0 -21
  126. package/docs/api/build/docs-assets/_templates/jira-feedback.html +0 -21
  127. package/docs/api/build/docs-assets/_templates/layout.html +0 -34
  128. package/docs/api/build/docs-assets/_templates/matomo.html +0 -18
  129. package/docs/api/build/docs-assets/_templates/navbar-logo.html +0 -5
  130. package/docs/api/build/docs-assets/_templates/navbar-nav.html +0 -44
  131. package/docs/api/build/docs-assets/_templates/prev-next.html +0 -19
  132. package/docs/api/build/docs-assets/_templates/versioned-canonical.html +0 -8
  133. package/docs/api/build/docs-assets/themes/inrupt/theme.conf +0 -18
  134. package/docs/api/build/doctrees/classes/ConfigurationError.doctree +0 -0
  135. package/docs/api/build/doctrees/classes/InMemoryStorage.doctree +0 -0
  136. package/docs/api/build/doctrees/classes/NotImplementedError.doctree +0 -0
  137. package/docs/api/build/doctrees/classes/Session.doctree +0 -0
  138. package/docs/api/build/doctrees/environment.pickle +0 -0
  139. package/docs/api/build/doctrees/functions.doctree +0 -0
  140. package/docs/api/build/doctrees/index.doctree +0 -0
  141. package/docs/api/build/doctrees/interfaces/ILoginInputOptions.doctree +0 -0
  142. package/docs/api/build/doctrees/interfaces/ISessionInfo.doctree +0 -0
  143. package/docs/api/build/doctrees/interfaces/ISessionOptions.doctree +0 -0
  144. package/docs/api/build/doctrees/interfaces/IStorage.doctree +0 -0
  145. package/docs/api/build/html/.buildinfo +0 -4
  146. package/docs/api/build/html/_static/basic.css +0 -905
  147. package/docs/api/build/html/_static/css/blank.css +0 -2
  148. package/docs/api/build/html/_static/css/index.ff1ffe594081f20da1ef19478df9384b.css +0 -6
  149. package/docs/api/build/html/_static/css/inrupt.css +0 -349
  150. package/docs/api/build/html/_static/css/theme.css +0 -120
  151. package/docs/api/build/html/_static/doctools.js +0 -323
  152. package/docs/api/build/html/_static/documentation_options.js +0 -12
  153. package/docs/api/build/html/_static/file.png +0 -0
  154. package/docs/api/build/html/_static/jquery-3.5.1.js +0 -10872
  155. package/docs/api/build/html/_static/jquery.js +0 -2
  156. package/docs/api/build/html/_static/js/index.be7d3bbb2ef33a8344ce.js +0 -32
  157. package/docs/api/build/html/_static/language_data.js +0 -297
  158. package/docs/api/build/html/_static/minus.png +0 -0
  159. package/docs/api/build/html/_static/plus.png +0 -0
  160. package/docs/api/build/html/_static/pygments.css +0 -74
  161. package/docs/api/build/html/_static/searchtools.js +0 -529
  162. package/docs/api/build/html/_static/underscore-1.13.1.js +0 -2042
  163. package/docs/api/build/html/_static/underscore.js +0 -6
  164. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/LICENSE.txt +0 -34
  165. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/css/all.min.css +0 -5
  166. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.eot +0 -0
  167. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.svg +0 -3570
  168. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.ttf +0 -0
  169. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff +0 -0
  170. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2 +0 -0
  171. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.eot +0 -0
  172. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.svg +0 -803
  173. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.ttf +0 -0
  174. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff +0 -0
  175. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff2 +0 -0
  176. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.eot +0 -0
  177. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.svg +0 -4938
  178. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.ttf +0 -0
  179. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff +0 -0
  180. package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2 +0 -0
  181. package/docs/api/build/html/_static/webpack-macros.html +0 -25
  182. package/docs/api/build/html/classes/ConfigurationError.html +0 -726
  183. package/docs/api/build/html/classes/InMemoryStorage.html +0 -636
  184. package/docs/api/build/html/classes/NotImplementedError.html +0 -726
  185. package/docs/api/build/html/classes/Session.html +0 -2428
  186. package/docs/api/build/html/functions.html +0 -834
  187. package/docs/api/build/html/genindex.html +0 -311
  188. package/docs/api/build/html/index.html +0 -342
  189. package/docs/api/build/html/interfaces/ILoginInputOptions.html +0 -595
  190. package/docs/api/build/html/interfaces/ISessionInfo.html +0 -481
  191. package/docs/api/build/html/interfaces/ISessionOptions.html +0 -463
  192. package/docs/api/build/html/interfaces/IStorage.html +0 -531
  193. package/docs/api/build/html/objects.inv +0 -0
  194. package/docs/api/build/html/search.html +0 -340
  195. package/docs/api/build/html/searchindex.js +0 -1
  196. package/docs/api/build/source/classes/ConfigurationError.md +0 -159
  197. package/docs/api/build/source/classes/InMemoryStorage.md +0 -112
  198. package/docs/api/build/source/classes/NotImplementedError.md +0 -159
  199. package/docs/api/build/source/classes/Session.md +0 -907
  200. package/docs/api/build/source/functions.md +0 -235
  201. package/docs/api/build/source/index.rst +0 -13
  202. package/docs/api/build/source/interfaces/ILoginInputOptions.md +0 -109
  203. package/docs/api/build/source/interfaces/ISessionInfo.md +0 -63
  204. package/docs/api/build/source/interfaces/ISessionOptions.md +0 -60
  205. package/docs/api/build/source/interfaces/IStorage.md +0 -76
  206. package/docs/api/conf.py +0 -135
  207. package/docs/api/redirects.txt +0 -41
  208. package/docs/api/requirements.txt +0 -5
  209. package/docs/api/source/api/.nojekyll +0 -1
  210. package/docs/api/source/api/classes/ConfigurationError.md +0 -163
  211. package/docs/api/source/api/classes/InMemoryStorage.md +0 -112
  212. package/docs/api/source/api/classes/NotImplementedError.md +0 -163
  213. package/docs/api/source/api/classes/Session.md +0 -1426
  214. package/docs/api/source/api/index.md +0 -251
  215. package/docs/api/source/api/interfaces/ILoginInputOptions.md +0 -109
  216. package/docs/api/source/api/interfaces/ISessionInfo.md +0 -63
  217. package/docs/api/source/api/interfaces/ISessionOptions.md +0 -60
  218. package/docs/api/source/api/interfaces/IStorage.md +0 -76
  219. package/docs/api/source/functions.md +0 -3
  220. package/docs/api/source/index.rst +0 -13
  221. package/examples/demoAuthentiationMonitor/index.js +0 -34
  222. package/examples/demoAuthentiationMonitor/package-lock.json +0 -916
  223. package/examples/demoAuthentiationMonitor/package.json +0 -15
  224. package/examples/demoClientApp/.babelrc +0 -3
  225. package/examples/demoClientApp/package-lock.json +0 -11710
  226. package/examples/demoClientApp/package.json +0 -37
  227. package/examples/demoClientApp/src/DemoClientApp.js +0 -686
  228. package/examples/demoClientApp/src/index.html +0 -142
  229. package/examples/demoClientApp/src/index.js +0 -26
  230. package/examples/demoClientApp/webpack.config.js +0 -39
  231. package/examples/single/bundle/.babelrc +0 -3
  232. package/examples/single/bundle/README.md +0 -11
  233. package/examples/single/bundle/client-app-profile.ttl +0 -10
  234. package/examples/single/bundle/package-lock.json +0 -11196
  235. package/examples/single/bundle/package.json +0 -31
  236. package/examples/single/bundle/src/App.js +0 -123
  237. package/examples/single/bundle/src/index.html +0 -10
  238. package/examples/single/bundle/src/index.js +0 -26
  239. package/examples/single/bundle/webpack.config.js +0 -33
  240. package/examples/single/script/README.md +0 -11
  241. package/examples/single/script/index.html +0 -36
  242. package/examples/single/script/package-lock.json +0 -1293
  243. package/examples/single/script/package.json +0 -20
  244. package/examples/single/script/server.ts +0 -18
  245. package/jest.config.js +0 -10
  246. package/licenses.csv +0 -147
  247. package/rollup.config.js +0 -54
  248. package/sampleFlows/SolidAuthClientArchitecture.png +0 -0
  249. package/sampleFlows/authorization-code-with-pkce.png +0 -0
  250. package/sampleFlows/authorization-code-with-pkce.seqdiag +0 -46
  251. package/sampleFlows/authorization-code.png +0 -0
  252. package/sampleFlows/authorization-code.seqdiag +0 -50
  253. package/sampleFlows/client-credentials.png +0 -0
  254. package/sampleFlows/client-credentials.seqdiag +0 -38
  255. package/sampleFlows/legacy-implicit-flow.png +0 -0
  256. package/sampleFlows/legacy-implicit-flow.seqdiag +0 -43
  257. package/sampleFlows/self-signed.png +0 -0
  258. package/sampleFlows/self-signed.seqdiag +0 -49
  259. package/sampleFlows/signatory-access-control.seqdiag +0 -36
  260. package/sampleFlows/signatory-access-control.svg +0 -1
  261. package/tsconfig.eslint.json +0 -6
  262. package/tsconfig.json +0 -17
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@inrupt/solid-client-authn-core'), require('@inrupt/oidc-client')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@inrupt/solid-client-authn-core', '@inrupt/oidc-client'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.solidClientAuthentication = {}, global.solidClientAuthnCore, global.oidcClient));
5
- })(this, (function (exports, solidClientAuthnCore, oidcClient) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@inrupt/solid-client-authn-core'), require('uuid'), require('@inrupt/oidc-client-ext')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@inrupt/solid-client-authn-core', 'uuid', '@inrupt/oidc-client-ext'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.solidClientAuthentication = {}, global.solidClientAuthnCore, global.uuid, global.oidcClientExt));
5
+ })(this, (function (exports, solidClientAuthnCore, uuid, oidcClientExt) { 'use strict';
6
6
 
7
7
  var domain;
8
8
 
@@ -476,362 +476,12 @@
476
476
  return ret;
477
477
  }
478
478
 
479
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
480
- // require the crypto API and do not support built-in fallback to lower quality random number
481
- // generators (like Math.random()).
482
- var getRandomValues;
483
- var rnds8 = new Uint8Array(16);
484
- function rng() {
485
- // lazy load so that environments that need to polyfill have a chance to do so
486
- if (!getRandomValues) {
487
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
488
- // find the complete implementation of crypto (msCrypto) on IE11.
489
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
490
-
491
- if (!getRandomValues) {
492
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
493
- }
494
- }
495
-
496
- return getRandomValues(rnds8);
497
- }
498
-
499
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
500
-
501
- function validate(uuid) {
502
- return typeof uuid === 'string' && REGEX.test(uuid);
503
- }
504
-
505
- /**
506
- * Convert array of 16 byte values to UUID string format of the form:
507
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
508
- */
509
-
510
- var byteToHex = [];
511
-
512
- for (var i = 0; i < 256; ++i) {
513
- byteToHex.push((i + 0x100).toString(16).substr(1));
514
- }
515
-
516
- function stringify(arr) {
517
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
518
- // Note: Be careful editing this code! It's been tuned for performance
519
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
520
- var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
521
- // of the following:
522
- // - One or more input array values don't map to a hex octet (leading to
523
- // "undefined" in the uuid)
524
- // - Invalid input values for the RFC `version` or `variant` fields
525
-
526
- if (!validate(uuid)) {
527
- throw TypeError('Stringified UUID is invalid');
528
- }
529
-
530
- return uuid;
531
- }
532
-
533
- function v4(options, buf, offset) {
534
- options = options || {};
535
- var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
536
-
537
- rnds[6] = rnds[6] & 0x0f | 0x40;
538
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
539
-
540
- if (buf) {
541
- offset = offset || 0;
542
-
543
- for (var i = 0; i < 16; ++i) {
544
- buf[offset + i] = rnds[i];
545
- }
546
-
547
- return buf;
548
- }
549
-
550
- return stringify(rnds);
551
- }
552
-
553
479
  class StorageUtilityBrowser extends solidClientAuthnCore.StorageUtility {
554
480
  constructor(secureStorage, insecureStorage) {
555
481
  super(secureStorage, insecureStorage);
556
482
  }
557
483
  }
558
484
 
559
- function processErrorResponse(responseBody, options) {
560
- var _a, _b, _c, _d;
561
- if (responseBody.error === "invalid_redirect_uri") {
562
- throw new Error(`Dynamic client registration failed: the provided redirect uri [${(_a = options.redirectUrl) === null || _a === void 0 ? void 0 : _a.toString()}] is invalid - ${(_b = responseBody.error_description) !== null && _b !== void 0 ? _b : ""}`);
563
- }
564
- if (responseBody.error === "invalid_client_metadata") {
565
- throw new Error(`Dynamic client registration failed: the provided client metadata ${JSON.stringify(options)} is invalid - ${(_c = responseBody.error_description) !== null && _c !== void 0 ? _c : ""}`);
566
- }
567
- throw new Error(`Dynamic client registration failed: ${responseBody.error} - ${(_d = responseBody.error_description) !== null && _d !== void 0 ? _d : ""}`);
568
- }
569
- function validateRegistrationResponse(responseBody, options) {
570
- if (responseBody.client_id === undefined) {
571
- throw new Error(`Dynamic client registration failed: no client_id has been found on ${JSON.stringify(responseBody)}`);
572
- }
573
- if (options.redirectUrl &&
574
- (responseBody.redirect_uris === undefined ||
575
- responseBody.redirect_uris[0] !== options.redirectUrl.toString())) {
576
- throw new Error(`Dynamic client registration failed: the returned redirect URIs ${JSON.stringify(responseBody.redirect_uris)} don't match the provided ${JSON.stringify([
577
- options.redirectUrl.toString(),
578
- ])}`);
579
- }
580
- }
581
- async function registerClient(options, issuerConfig) {
582
- var _a;
583
- if (!issuerConfig.registrationEndpoint) {
584
- throw new Error("Dynamic Registration could not be completed because the issuer has no registration endpoint.");
585
- }
586
- if (!Array.isArray(issuerConfig.idTokenSigningAlgValuesSupported)) {
587
- throw new Error("The OIDC issuer discovery profile is missing the 'id_token_signing_alg_values_supported' value, which is mandatory.");
588
- }
589
- const signingAlg = solidClientAuthnCore.determineSigningAlg(issuerConfig.idTokenSigningAlgValuesSupported, solidClientAuthnCore.PREFERRED_SIGNING_ALG);
590
- const config = {
591
- client_name: options.clientName,
592
- application_type: "web",
593
- redirect_uris: [(_a = options.redirectUrl) === null || _a === void 0 ? void 0 : _a.toString()],
594
- subject_type: "public",
595
- token_endpoint_auth_method: "client_secret_basic",
596
- id_token_signed_response_alg: signingAlg,
597
- grant_types: ["authorization_code", "refresh_token"],
598
- };
599
- const headers = {
600
- "Content-Type": "application/json",
601
- };
602
- if (options.registrationAccessToken) {
603
- headers.Authorization = `Bearer ${options.registrationAccessToken}`;
604
- }
605
- const registerResponse = await fetch(issuerConfig.registrationEndpoint.toString(), {
606
- method: "POST",
607
- headers,
608
- body: JSON.stringify(config),
609
- });
610
- if (registerResponse.ok) {
611
- const responseBody = await registerResponse.json();
612
- validateRegistrationResponse(responseBody, options);
613
- return {
614
- clientId: responseBody.client_id,
615
- clientSecret: responseBody.client_secret,
616
- idTokenSignedResponseAlg: responseBody.id_token_signed_response_alg,
617
- clientType: "dynamic",
618
- };
619
- }
620
- if (registerResponse.status === 400) {
621
- processErrorResponse(await registerResponse.json(), options);
622
- }
623
- throw new Error(`Dynamic client registration failed: the server returned ${registerResponse.status} ${registerResponse.statusText} - ${await registerResponse.text()}`);
624
- }
625
-
626
- function hasError(value) {
627
- return value.error !== undefined && typeof value.error === "string";
628
- }
629
- function hasErrorDescription(value) {
630
- return (value.error_description !== undefined &&
631
- typeof value.error_description === "string");
632
- }
633
- function hasErrorUri(value) {
634
- return value.error_uri !== undefined && typeof value.error_uri === "string";
635
- }
636
- function hasAccessToken(value) {
637
- return (value.access_token !== undefined && typeof value.access_token === "string");
638
- }
639
- function hasIdToken(value) {
640
- return value.id_token !== undefined && typeof value.id_token === "string";
641
- }
642
- function hasRefreshToken(value) {
643
- return (value.refresh_token !== undefined && typeof value.refresh_token === "string");
644
- }
645
- function hasTokenType(value) {
646
- return value.token_type !== undefined && typeof value.token_type === "string";
647
- }
648
- function hasExpiresIn(value) {
649
- return value.expires_in === undefined || typeof value.expires_in === "number";
650
- }
651
- function validatePreconditions(issuer, data) {
652
- if (data.grantType &&
653
- (!issuer.grantTypesSupported ||
654
- !issuer.grantTypesSupported.includes(data.grantType))) {
655
- throw new Error(`The issuer [${issuer.issuer}] does not support the [${data.grantType}] grant`);
656
- }
657
- if (!issuer.tokenEndpoint) {
658
- throw new Error(`This issuer [${issuer.issuer}] does not have a token endpoint`);
659
- }
660
- }
661
- function validateTokenEndpointResponse(tokenResponse, dpop) {
662
- if (hasError(tokenResponse)) {
663
- throw new solidClientAuthnCore.OidcProviderError(`Token endpoint returned error [${tokenResponse.error}]${hasErrorDescription(tokenResponse)
664
- ? `: ${tokenResponse.error_description}`
665
- : ""}${hasErrorUri(tokenResponse) ? ` (see ${tokenResponse.error_uri})` : ""}`, tokenResponse.error, hasErrorDescription(tokenResponse)
666
- ? tokenResponse.error_description
667
- : undefined);
668
- }
669
- if (!hasAccessToken(tokenResponse)) {
670
- throw new solidClientAuthnCore.InvalidResponseError(["access_token"]);
671
- }
672
- if (!hasIdToken(tokenResponse)) {
673
- throw new solidClientAuthnCore.InvalidResponseError(["id_token"]);
674
- }
675
- if (!hasTokenType(tokenResponse)) {
676
- throw new solidClientAuthnCore.InvalidResponseError(["token_type"]);
677
- }
678
- if (!hasExpiresIn(tokenResponse)) {
679
- throw new solidClientAuthnCore.InvalidResponseError(["expires_in"]);
680
- }
681
- if (!dpop && tokenResponse.token_type.toLowerCase() !== "bearer") {
682
- throw new Error(`Invalid token endpoint response: requested a [Bearer] token, but got a 'token_type' value of [${tokenResponse.token_type}].`);
683
- }
684
- return tokenResponse;
685
- }
686
- async function getTokens(issuer, client, data, dpop) {
687
- validatePreconditions(issuer, data);
688
- const headers = {
689
- "content-type": "application/x-www-form-urlencoded",
690
- };
691
- let dpopKey;
692
- if (dpop) {
693
- dpopKey = await solidClientAuthnCore.generateDpopKeyPair();
694
- headers.DPoP = await solidClientAuthnCore.createDpopHeader(issuer.tokenEndpoint, "POST", dpopKey);
695
- }
696
- if (client.clientSecret) {
697
- headers.Authorization = `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`;
698
- }
699
- const requestBody = {
700
- grant_type: data.grantType,
701
- redirect_uri: data.redirectUrl,
702
- code: data.code,
703
- code_verifier: data.codeVerifier,
704
- client_id: client.clientId,
705
- };
706
- const tokenRequestInit = {
707
- method: "POST",
708
- headers,
709
- body: new URLSearchParams(requestBody).toString(),
710
- };
711
- const rawTokenResponse = await await fetch(issuer.tokenEndpoint, tokenRequestInit);
712
- const jsonTokenResponse = (await rawTokenResponse.json());
713
- const tokenResponse = validateTokenEndpointResponse(jsonTokenResponse, dpop);
714
- const webId = await solidClientAuthnCore.getWebidFromTokenPayload(tokenResponse.id_token, issuer.jwksUri, issuer.issuer, client.clientId);
715
- return {
716
- accessToken: tokenResponse.access_token,
717
- idToken: tokenResponse.id_token,
718
- refreshToken: hasRefreshToken(tokenResponse)
719
- ? tokenResponse.refresh_token
720
- : undefined,
721
- webId,
722
- dpopKey,
723
- expiresIn: tokenResponse.expires_in,
724
- };
725
- }
726
- async function getBearerToken(redirectUrl) {
727
- let signinResponse;
728
- try {
729
- const client = new oidcClient.OidcClient({
730
- response_mode: "query",
731
- loadUserInfo: false,
732
- });
733
- signinResponse = await client.processSigninResponse(redirectUrl);
734
- if (client.settings.metadata === undefined) {
735
- throw new Error("Cannot retrieve issuer metadata from client information in storage.");
736
- }
737
- if (client.settings.metadata.jwks_uri === undefined) {
738
- throw new Error("Missing some issuer metadata from client information in storage: 'jwks_uri' is undefined");
739
- }
740
- if (client.settings.metadata.issuer === undefined) {
741
- throw new Error("Missing some issuer metadata from client information in storage: 'issuer' is undefined");
742
- }
743
- if (client.settings.client_id === undefined) {
744
- throw new Error("Missing some client information in storage: 'client_id' is undefined");
745
- }
746
- const webId = await solidClientAuthnCore.getWebidFromTokenPayload(signinResponse.id_token, client.settings.metadata.jwks_uri, client.settings.metadata.issuer, client.settings.client_id);
747
- return {
748
- accessToken: signinResponse.access_token,
749
- idToken: signinResponse.id_token,
750
- webId,
751
- refreshToken: signinResponse.refresh_token,
752
- };
753
- }
754
- catch (err) {
755
- throw new Error(`Problem handling Auth Code Grant (Flow) redirect - URL [${redirectUrl}]: ${err}`);
756
- }
757
- }
758
- async function getDpopToken(issuer, client, data) {
759
- return getTokens(issuer, client, data, true);
760
- }
761
-
762
- async function refresh(refreshToken, issuer, client, dpopKey) {
763
- const requestBody = {
764
- grant_type: "refresh_token",
765
- refresh_token: refreshToken,
766
- scope: "openid offline_access",
767
- };
768
- let dpopHeader = {};
769
- if (dpopKey !== undefined) {
770
- dpopHeader = {
771
- DPoP: await solidClientAuthnCore.createDpopHeader(issuer.tokenEndpoint, "POST", dpopKey),
772
- };
773
- }
774
- let authHeader = {};
775
- if (client.clientSecret !== undefined) {
776
- authHeader = {
777
- Authorization: `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`,
778
- };
779
- }
780
- const rawResponse = await fetch(issuer.tokenEndpoint, {
781
- method: "POST",
782
- body: new URLSearchParams(requestBody).toString(),
783
- headers: {
784
- ...dpopHeader,
785
- ...authHeader,
786
- "Content-Type": "application/x-www-form-urlencoded",
787
- },
788
- });
789
- let response;
790
- try {
791
- response = await rawResponse.json();
792
- }
793
- catch (e) {
794
- throw new Error(`The token endpoint of issuer ${issuer.issuer} returned a malformed response.`);
795
- }
796
- const validatedResponse = validateTokenEndpointResponse(response, dpopKey !== undefined);
797
- const webId = await solidClientAuthnCore.getWebidFromTokenPayload(validatedResponse.id_token, issuer.jwksUri, issuer.issuer, client.clientId);
798
- return {
799
- accessToken: validatedResponse.access_token,
800
- idToken: validatedResponse.id_token,
801
- refreshToken: typeof validatedResponse.refresh_token === "string"
802
- ? validatedResponse.refresh_token
803
- : undefined,
804
- webId,
805
- dpopKey,
806
- expiresIn: validatedResponse.expires_in,
807
- };
808
- }
809
-
810
- function removeOidcQueryParam(redirectUrl) {
811
- const cleanedUrl = new URL(redirectUrl);
812
- cleanedUrl.searchParams.delete("code");
813
- cleanedUrl.searchParams.delete("state");
814
- cleanedUrl.hash = "";
815
- return cleanedUrl.toString();
816
- }
817
- async function clearOidcPersistentStorage() {
818
- const client = new oidcClient.OidcClient({
819
- response_mode: "query",
820
- });
821
- await client.clearStaleState(new oidcClient.WebStorageStateStore({}));
822
- const myStorage = window.localStorage;
823
- const itemsToRemove = [];
824
- for (let i = 0; i <= myStorage.length; i += 1) {
825
- const key = myStorage.key(i);
826
- if (key &&
827
- (key.match(/^oidc\..+$/) ||
828
- key.match(/^solidClientAuthenticationUser:.+$/))) {
829
- itemsToRemove.push(key);
830
- }
831
- }
832
- itemsToRemove.forEach((key) => myStorage.removeItem(key));
833
- }
834
-
835
485
  const globalFetch = (request, init) => window.fetch(request, init);
836
486
  class ClientAuthentication {
837
487
  constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) {
@@ -843,7 +493,7 @@
843
493
  this.login = async (options, eventEmitter) => {
844
494
  var _a, _b;
845
495
  await this.sessionInfoManager.clear(options.sessionId);
846
- const redirectUrl = removeOidcQueryParam((_a = options.redirectUrl) !== null && _a !== void 0 ? _a : window.location.href);
496
+ const redirectUrl = oidcClientExt.removeOidcQueryParam((_a = options.redirectUrl) !== null && _a !== void 0 ? _a : window.location.href);
847
497
  await this.loginHandler.handle({
848
498
  ...options,
849
499
  redirectUrl,
@@ -961,7 +611,7 @@
961
611
  code_verifier: true,
962
612
  prompt: (_a = oidcLoginOptions.prompt) !== null && _a !== void 0 ? _a : "consent",
963
613
  };
964
- const oidcClientLibrary = new oidcClient.OidcClient(oidcOptions);
614
+ const oidcClientLibrary = new oidcClientExt.OidcClient(oidcOptions);
965
615
  const { redirector } = this;
966
616
  const storage = this.storageUtility;
967
617
  try {
@@ -1117,7 +767,7 @@
1117
767
  function getUnauthenticatedSession() {
1118
768
  return {
1119
769
  isLoggedIn: false,
1120
- sessionId: v4(),
770
+ sessionId: uuid.v4(),
1121
771
  fetch,
1122
772
  };
1123
773
  }
@@ -1127,7 +777,7 @@
1127
777
  storage.deleteAllUserData(sessionId, { secure: true }),
1128
778
  storage.delete("clientKey", { secure: false }),
1129
779
  ]);
1130
- await clearOidcPersistentStorage();
780
+ await oidcClientExt.clearOidcPersistentStorage();
1131
781
  }
1132
782
  class SessionInfoManager {
1133
783
  constructor(storageUtility) {
@@ -1265,7 +915,7 @@
1265
915
  let tokens;
1266
916
  const tokenCreatedAt = Date.now();
1267
917
  if (isDpop) {
1268
- tokens = await getDpopToken(issuerConfig, client, {
918
+ tokens = await oidcClientExt.getDpopToken(issuerConfig, client, {
1269
919
  grantType: "authorization_code",
1270
920
  code: url.searchParams.get("code"),
1271
921
  codeVerifier,
@@ -1274,7 +924,7 @@
1274
924
  window.localStorage.removeItem(`oidc.${oauthState}`);
1275
925
  }
1276
926
  else {
1277
- tokens = await getBearerToken(url.toString());
927
+ tokens = await oidcClientExt.getBearerToken(url.toString());
1278
928
  }
1279
929
  let refreshOptions;
1280
930
  if (tokens.refreshToken !== undefined) {
@@ -1413,7 +1063,7 @@
1413
1063
  extendedOptions.registrationAccessToken =
1414
1064
  (_a = extendedOptions.registrationAccessToken) !== null && _a !== void 0 ? _a : (await this.storageUtility.getForUser(options.sessionId, "registrationAccessToken"));
1415
1065
  try {
1416
- const registeredClient = await registerClient(extendedOptions, issuerConfig);
1066
+ const registeredClient = await oidcClientExt.registerClient(extendedOptions, issuerConfig);
1417
1067
  const infoToSave = {
1418
1068
  clientId: registeredClient.clientId,
1419
1069
  };
@@ -1470,7 +1120,7 @@
1470
1120
  if (oidcContext.dpop && dpopKey === undefined) {
1471
1121
  throw new Error(`For session [${sessionId}], the key bound to the DPoP access token must be provided to refresh said access token.`);
1472
1122
  }
1473
- const tokenSet = await refresh(refreshToken, oidcContext.issuerConfig, clientInfo, dpopKey);
1123
+ const tokenSet = await oidcClientExt.refresh(refreshToken, oidcContext.issuerConfig, clientInfo, dpopKey);
1474
1124
  if (tokenSet.refreshToken !== undefined) {
1475
1125
  eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(solidClientAuthnCore.EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken);
1476
1126
  await this.storageUtility.setForUser(sessionId, {
@@ -1611,7 +1261,7 @@
1611
1261
  }
1612
1262
  else {
1613
1263
  this.info = {
1614
- sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : v4(),
1264
+ sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : uuid.v4(),
1615
1265
  isLoggedIn: false,
1616
1266
  };
1617
1267
  }
@@ -1718,3 +1368,4 @@
1718
1368
  Object.defineProperty(exports, '__esModule', { value: true });
1719
1369
 
1720
1370
  }));
1371
+ //# sourceMappingURL=solid-client-authn.bundle.js.map