solid-ui 2.4.30-f0d40afb → 2.4.31-f40cba95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/solid-ui.js +1259 -845
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.js.map +1 -1
- package/lib/versionInfo.js +3 -3
- package/lib/versionInfo.js.map +1 -1
- package/package.json +4 -4
package/dist/solid-ui.js
CHANGED
|
@@ -13695,10 +13695,10 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13695
13695
|
}));
|
|
13696
13696
|
exports.versionInfo = void 0;
|
|
13697
13697
|
var versionInfo = exports.versionInfo = {
|
|
13698
|
-
buildTime: '2023-12-01T20:
|
|
13699
|
-
commit: '
|
|
13698
|
+
buildTime: '2023-12-01T20:22:18Z',
|
|
13699
|
+
commit: 'f40cba957f0cdc0d34ddace42069ce1ae87744af',
|
|
13700
13700
|
npmInfo: {
|
|
13701
|
-
'solid-ui': '2.4.
|
|
13701
|
+
'solid-ui': '2.4.31',
|
|
13702
13702
|
npm: '8.19.4',
|
|
13703
13703
|
node: '16.20.2',
|
|
13704
13704
|
v8: '9.4.146.26-node.26',
|
|
@@ -26348,51 +26348,113 @@ e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,h=-7,l=r?i-1:0,f=
|
|
|
26348
26348
|
|
|
26349
26349
|
/***/ }),
|
|
26350
26350
|
|
|
26351
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/
|
|
26352
|
-
|
|
26353
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/
|
|
26354
|
-
|
|
26351
|
+
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/index.js":
|
|
26352
|
+
/*!***********************************************************************!*\
|
|
26353
|
+
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/index.js ***!
|
|
26354
|
+
\***********************************************************************/
|
|
26355
26355
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
26356
26356
|
|
|
26357
26357
|
"use strict";
|
|
26358
26358
|
|
|
26359
|
-
|
|
26360
|
-
|
|
26361
|
-
|
|
26362
|
-
|
|
26363
|
-
|
|
26364
|
-
|
|
26365
|
-
|
|
26366
|
-
|
|
26367
|
-
|
|
26368
|
-
|
|
26369
|
-
|
|
26370
|
-
|
|
26359
|
+
|
|
26360
|
+
var solidClientAuthnCore = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
|
|
26361
|
+
var uuid = __webpack_require__(/*! uuid */ "./node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/commonjs-browser/index.js");
|
|
26362
|
+
var EventEmitter = __webpack_require__(/*! events */ "./node_modules/events/events.js");
|
|
26363
|
+
var oidcClientExt = __webpack_require__(/*! @inrupt/oidc-client-ext */ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js");
|
|
26364
|
+
var universalFetch = __webpack_require__(/*! @inrupt/universal-fetch */ "./node_modules/@inrupt/universal-fetch/dist/index-browser.js");
|
|
26365
|
+
|
|
26366
|
+
//
|
|
26367
|
+
// Copyright Inrupt Inc.
|
|
26368
|
+
//
|
|
26369
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26370
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
26371
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
26372
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
26373
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
26374
|
+
// subject to the following conditions:
|
|
26375
|
+
//
|
|
26376
|
+
// The above copyright notice and this permission notice shall be included in
|
|
26377
|
+
// all copies or substantial portions of the Software.
|
|
26378
|
+
//
|
|
26379
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
26380
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
26381
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26382
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26383
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
26384
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26385
|
+
//
|
|
26386
|
+
/**
|
|
26387
|
+
* This class in a no-value-added extension of StorageUtility from the core module.
|
|
26388
|
+
* The reason it has to be declared is for TSyringe to find the decorators in the
|
|
26389
|
+
* same modules as where the dependency container is declared (in this case,
|
|
26390
|
+
* the browser module, with the dependancy container in dependencies.ts).
|
|
26391
|
+
* @hidden
|
|
26392
|
+
*/
|
|
26393
|
+
class StorageUtilityBrowser extends solidClientAuthnCore.StorageUtility {
|
|
26394
|
+
constructor(secureStorage, insecureStorage) {
|
|
26395
|
+
super(secureStorage, insecureStorage);
|
|
26396
|
+
}
|
|
26397
|
+
}
|
|
26398
|
+
|
|
26399
|
+
//
|
|
26400
|
+
// Copyright Inrupt Inc.
|
|
26401
|
+
//
|
|
26402
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26403
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
26404
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
26405
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
26406
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
26407
|
+
// subject to the following conditions:
|
|
26408
|
+
//
|
|
26409
|
+
// The above copyright notice and this permission notice shall be included in
|
|
26410
|
+
// all copies or substantial portions of the Software.
|
|
26411
|
+
//
|
|
26412
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
26413
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
26414
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26415
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26416
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
26417
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26418
|
+
//
|
|
26419
|
+
/**
|
|
26420
|
+
* @hidden
|
|
26421
|
+
*/
|
|
26422
|
+
class ClientAuthentication extends solidClientAuthnCore.ClientAuthentication {
|
|
26423
|
+
constructor() {
|
|
26424
|
+
super(...arguments);
|
|
26425
|
+
// Define these functions as properties so that they don't get accidentally re-bound.
|
|
26426
|
+
// Isn't Javascript fun?
|
|
26371
26427
|
this.login = async (options, eventEmitter) => {
|
|
26372
26428
|
var _a, _b;
|
|
26429
|
+
// In order to get a clean start, make sure that the session is logged out
|
|
26430
|
+
// on login.
|
|
26431
|
+
// But we may want to preserve our client application info, particularly if
|
|
26432
|
+
// we used Dynamic Client Registration to register (since we don't
|
|
26433
|
+
// necessarily want the user to have to register this app each time they
|
|
26434
|
+
// login).
|
|
26373
26435
|
await this.sessionInfoManager.clear(options.sessionId);
|
|
26374
|
-
|
|
26375
|
-
|
|
26376
|
-
|
|
26436
|
+
// In the case of the user hitting the 'back' button in their browser, they
|
|
26437
|
+
// could return to a previous redirect URL that contains OIDC params that
|
|
26438
|
+
// are now longer valid. To be safe, strip relevant params now.
|
|
26439
|
+
// If the user is providing a redirect IRI, it should not be modified, so
|
|
26440
|
+
// normalization only applies if we default to the current location (which is
|
|
26441
|
+
// a bad practice and should be discouraged).
|
|
26442
|
+
const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : oidcClientExt.normalizeCallbackUrl(window.location.href);
|
|
26443
|
+
if (!solidClientAuthnCore.isValidRedirectUrl(redirectUrl)) {
|
|
26444
|
+
throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI, includes a hash fragment, or reserved query parameters ('code' or 'state').`);
|
|
26377
26445
|
}
|
|
26378
26446
|
await this.loginHandler.handle({
|
|
26379
26447
|
...options,
|
|
26380
26448
|
redirectUrl,
|
|
26449
|
+
// If no clientName is provided, the clientId may be used instead.
|
|
26381
26450
|
clientName: (_b = options.clientName) !== null && _b !== void 0 ? _b : options.clientId,
|
|
26382
26451
|
eventEmitter,
|
|
26383
26452
|
});
|
|
26384
26453
|
};
|
|
26385
|
-
|
|
26386
|
-
|
|
26387
|
-
|
|
26388
|
-
|
|
26389
|
-
};
|
|
26390
|
-
this.getSessionInfo = async (sessionId) => {
|
|
26391
|
-
return this.sessionInfoManager.get(sessionId);
|
|
26392
|
-
};
|
|
26393
|
-
this.getAllSessionInfo = async () => {
|
|
26394
|
-
return this.sessionInfoManager.getAll();
|
|
26395
|
-
};
|
|
26454
|
+
// Collects session information from storage, and returns them. Returns null
|
|
26455
|
+
// if the expected information cannot be found.
|
|
26456
|
+
// Note that the ID token is not stored, which means the session information
|
|
26457
|
+
// cannot be validated at this point.
|
|
26396
26458
|
this.validateCurrentSession = async (currentSessionId) => {
|
|
26397
26459
|
const sessionInfo = await this.sessionInfoManager.get(currentSessionId);
|
|
26398
26460
|
if (sessionInfo === undefined ||
|
|
@@ -26405,8 +26467,14 @@ class ClientAuthentication {
|
|
|
26405
26467
|
this.handleIncomingRedirect = async (url, eventEmitter) => {
|
|
26406
26468
|
try {
|
|
26407
26469
|
const redirectInfo = await this.redirectHandler.handle(url, eventEmitter);
|
|
26470
|
+
// The `FallbackRedirectHandler` directly returns the global `fetch` for
|
|
26471
|
+
// his value, so we should ensure it's bound to `window` rather than to
|
|
26472
|
+
// ClientAuthentication, to avoid the following error:
|
|
26473
|
+
// > 'fetch' called on an object that does not implement interface Window.
|
|
26408
26474
|
this.fetch = redirectInfo.fetch.bind(window);
|
|
26409
|
-
this.
|
|
26475
|
+
this.boundLogout = redirectInfo.getLogoutUrl;
|
|
26476
|
+
// Strip the oauth params:
|
|
26477
|
+
await this.cleanUrlAfterRedirect(url);
|
|
26410
26478
|
return {
|
|
26411
26479
|
isLoggedIn: redirectInfo.isLoggedIn,
|
|
26412
26480
|
webId: redirectInfo.webId,
|
|
@@ -26415,447 +26483,202 @@ class ClientAuthentication {
|
|
|
26415
26483
|
};
|
|
26416
26484
|
}
|
|
26417
26485
|
catch (err) {
|
|
26418
|
-
|
|
26419
|
-
|
|
26486
|
+
// Strip the oauth params:
|
|
26487
|
+
await this.cleanUrlAfterRedirect(url);
|
|
26488
|
+
// FIXME: EVENTS.ERROR should be errorCode, errorDescription
|
|
26489
|
+
//
|
|
26490
|
+
// I'm not sure if "redirect" is a good error code, and in theory `err`
|
|
26491
|
+
// maybe an Error object and not a string; Maybe we want to just hardcode
|
|
26492
|
+
// a description instead?
|
|
26493
|
+
eventEmitter.emit(solidClientAuthnCore.EVENTS.ERROR, "redirect", err);
|
|
26420
26494
|
return undefined;
|
|
26421
26495
|
}
|
|
26422
26496
|
};
|
|
26423
26497
|
}
|
|
26424
|
-
cleanUrlAfterRedirect(url) {
|
|
26425
|
-
const cleanedUpUrl =
|
|
26426
|
-
|
|
26427
|
-
|
|
26428
|
-
|
|
26429
|
-
|
|
26430
|
-
|
|
26431
|
-
|
|
26432
|
-
|
|
26433
|
-
|
|
26498
|
+
async cleanUrlAfterRedirect(url) {
|
|
26499
|
+
const cleanedUpUrl = solidClientAuthnCore.removeOpenIdParams(url).href;
|
|
26500
|
+
// Remove OAuth-specific query params (since the login flow finishes with
|
|
26501
|
+
// the browser being redirected back with OAuth2 query params (e.g. for
|
|
26502
|
+
// 'code' and 'state'), and so if the user simply refreshes this page our
|
|
26503
|
+
// authentication library will be called again with what are now invalid
|
|
26504
|
+
// query parameters!).
|
|
26505
|
+
window.history.replaceState(null, "", cleanedUpUrl);
|
|
26506
|
+
while (window.location.href !== cleanedUpUrl) {
|
|
26507
|
+
// Poll the current URL every ms. Active polling is required because
|
|
26508
|
+
// window.history.replaceState is asynchronous, but the associated
|
|
26509
|
+
// 'popstate' event which should be listened to is only sent on active
|
|
26510
|
+
// navigation, which we will not have here.
|
|
26511
|
+
// See https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event#when_popstate_is_sent
|
|
26512
|
+
// eslint-disable-next-line no-await-in-loop
|
|
26513
|
+
await new Promise((resolve) => {
|
|
26514
|
+
setTimeout(() => resolve(), 1);
|
|
26515
|
+
});
|
|
26516
|
+
}
|
|
26434
26517
|
}
|
|
26435
26518
|
}
|
|
26436
|
-
exports["default"] = ClientAuthentication;
|
|
26437
|
-
//# sourceMappingURL=ClientAuthentication.js.map
|
|
26438
|
-
|
|
26439
|
-
/***/ }),
|
|
26440
|
-
|
|
26441
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/Session.js":
|
|
26442
|
-
/*!*************************************************************************!*\
|
|
26443
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/Session.js ***!
|
|
26444
|
-
\*************************************************************************/
|
|
26445
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
26446
|
-
|
|
26447
|
-
"use strict";
|
|
26448
26519
|
|
|
26449
|
-
|
|
26450
|
-
|
|
26451
|
-
|
|
26452
|
-
|
|
26453
|
-
|
|
26454
|
-
|
|
26455
|
-
|
|
26456
|
-
|
|
26457
|
-
|
|
26458
|
-
|
|
26459
|
-
|
|
26460
|
-
|
|
26461
|
-
|
|
26462
|
-
|
|
26463
|
-
|
|
26464
|
-
|
|
26465
|
-
|
|
26466
|
-
|
|
26467
|
-
|
|
26468
|
-
|
|
26469
|
-
|
|
26470
|
-
|
|
26471
|
-
tokenType: (_a = storedSessionInfo.tokenType) !== null && _a !== void 0 ? _a : "DPoP",
|
|
26472
|
-
}, session.events);
|
|
26473
|
-
return true;
|
|
26474
|
-
}
|
|
26475
|
-
return false;
|
|
26520
|
+
//
|
|
26521
|
+
// Copyright Inrupt Inc.
|
|
26522
|
+
//
|
|
26523
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26524
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
26525
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
26526
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
26527
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
26528
|
+
// subject to the following conditions:
|
|
26529
|
+
//
|
|
26530
|
+
// The above copyright notice and this permission notice shall be included in
|
|
26531
|
+
// all copies or substantial portions of the Software.
|
|
26532
|
+
//
|
|
26533
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
26534
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
26535
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26536
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26537
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
26538
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26539
|
+
//
|
|
26540
|
+
function hasIssuer(options) {
|
|
26541
|
+
return typeof options.oidcIssuer === "string";
|
|
26476
26542
|
}
|
|
26477
|
-
|
|
26478
|
-
|
|
26479
|
-
return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
|
|
26543
|
+
function hasRedirectUrl(options) {
|
|
26544
|
+
return typeof options.redirectUrl === "string";
|
|
26480
26545
|
}
|
|
26481
|
-
|
|
26482
|
-
|
|
26483
|
-
|
|
26484
|
-
|
|
26485
|
-
|
|
26486
|
-
|
|
26487
|
-
|
|
26488
|
-
|
|
26489
|
-
|
|
26490
|
-
|
|
26491
|
-
|
|
26492
|
-
|
|
26493
|
-
|
|
26494
|
-
this.fetch = async (url, init) => {
|
|
26495
|
-
return this.clientAuthentication.fetch(url, init);
|
|
26496
|
-
};
|
|
26497
|
-
this.internalLogout = async (emitSignal) => {
|
|
26498
|
-
window.localStorage.removeItem(constant_1.KEY_CURRENT_SESSION);
|
|
26499
|
-
await this.clientAuthentication.logout(this.info.sessionId);
|
|
26500
|
-
this.info.isLoggedIn = false;
|
|
26501
|
-
if (emitSignal) {
|
|
26502
|
-
this.events.emit(solid_client_authn_core_1.EVENTS.LOGOUT);
|
|
26503
|
-
}
|
|
26504
|
-
};
|
|
26505
|
-
this.logout = async () => this.internalLogout(true);
|
|
26506
|
-
this.handleIncomingRedirect = async (inputOptions = {}) => {
|
|
26507
|
-
var _a;
|
|
26508
|
-
if (this.info.isLoggedIn) {
|
|
26509
|
-
return this.info;
|
|
26510
|
-
}
|
|
26511
|
-
if (this.tokenRequestInProgress) {
|
|
26512
|
-
return undefined;
|
|
26513
|
-
}
|
|
26514
|
-
const options = typeof inputOptions === "string" ? { url: inputOptions } : inputOptions;
|
|
26515
|
-
const url = (_a = options.url) !== null && _a !== void 0 ? _a : window.location.href;
|
|
26516
|
-
this.tokenRequestInProgress = true;
|
|
26517
|
-
const sessionInfo = await this.clientAuthentication.handleIncomingRedirect(url, this.events);
|
|
26518
|
-
if (isLoggedIn(sessionInfo)) {
|
|
26519
|
-
this.setSessionInfo(sessionInfo);
|
|
26520
|
-
const currentUrl = window.localStorage.getItem(constant_1.KEY_CURRENT_URL);
|
|
26521
|
-
if (currentUrl === null) {
|
|
26522
|
-
this.events.emit(solid_client_authn_core_1.EVENTS.LOGIN);
|
|
26523
|
-
}
|
|
26524
|
-
else {
|
|
26525
|
-
window.localStorage.removeItem(constant_1.KEY_CURRENT_URL);
|
|
26526
|
-
this.events.emit(solid_client_authn_core_1.EVENTS.SESSION_RESTORED, currentUrl);
|
|
26527
|
-
}
|
|
26528
|
-
}
|
|
26529
|
-
else if (options.restorePreviousSession === true) {
|
|
26530
|
-
const storedSessionId = window.localStorage.getItem(constant_1.KEY_CURRENT_SESSION);
|
|
26531
|
-
if (storedSessionId !== null) {
|
|
26532
|
-
const attemptedSilentAuthentication = await silentlyAuthenticate(storedSessionId, this.clientAuthentication, this);
|
|
26533
|
-
if (attemptedSilentAuthentication) {
|
|
26534
|
-
return new Promise(() => { });
|
|
26535
|
-
}
|
|
26536
|
-
}
|
|
26537
|
-
}
|
|
26538
|
-
this.tokenRequestInProgress = false;
|
|
26539
|
-
return sessionInfo;
|
|
26540
|
-
};
|
|
26541
|
-
this.events = new Proxy(this, (0, solid_client_authn_core_1.buildProxyHandler)(Session.prototype, "events only implements ISessionEventListener"));
|
|
26542
|
-
if (sessionOptions.clientAuthentication) {
|
|
26543
|
-
this.clientAuthentication = sessionOptions.clientAuthentication;
|
|
26544
|
-
}
|
|
26545
|
-
else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) {
|
|
26546
|
-
this.clientAuthentication = (0, dependencies_1.getClientAuthenticationWithDependencies)({
|
|
26547
|
-
secureStorage: sessionOptions.secureStorage,
|
|
26548
|
-
insecureStorage: sessionOptions.insecureStorage,
|
|
26549
|
-
});
|
|
26550
|
-
}
|
|
26551
|
-
else {
|
|
26552
|
-
this.clientAuthentication = (0, dependencies_1.getClientAuthenticationWithDependencies)({});
|
|
26553
|
-
}
|
|
26554
|
-
if (sessionOptions.sessionInfo) {
|
|
26555
|
-
this.info = {
|
|
26556
|
-
sessionId: sessionOptions.sessionInfo.sessionId,
|
|
26557
|
-
isLoggedIn: false,
|
|
26558
|
-
webId: sessionOptions.sessionInfo.webId,
|
|
26559
|
-
};
|
|
26560
|
-
}
|
|
26561
|
-
else {
|
|
26562
|
-
this.info = {
|
|
26563
|
-
sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : (0, uuid_1.v4)(),
|
|
26564
|
-
isLoggedIn: false,
|
|
26565
|
-
};
|
|
26566
|
-
}
|
|
26567
|
-
this.events.on(solid_client_authn_core_1.EVENTS.LOGIN, () => window.localStorage.setItem(constant_1.KEY_CURRENT_SESSION, this.info.sessionId));
|
|
26568
|
-
this.events.on(solid_client_authn_core_1.EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
|
|
26569
|
-
this.events.on(solid_client_authn_core_1.EVENTS.ERROR, () => this.internalLogout(false));
|
|
26570
|
-
}
|
|
26571
|
-
onLogin(callback) {
|
|
26572
|
-
this.events.on(solid_client_authn_core_1.EVENTS.LOGIN, callback);
|
|
26573
|
-
}
|
|
26574
|
-
onLogout(callback) {
|
|
26575
|
-
this.events.on(solid_client_authn_core_1.EVENTS.LOGOUT, callback);
|
|
26576
|
-
}
|
|
26577
|
-
onError(callback) {
|
|
26578
|
-
this.events.on(solid_client_authn_core_1.EVENTS.ERROR, callback);
|
|
26579
|
-
}
|
|
26580
|
-
onSessionRestore(callback) {
|
|
26581
|
-
this.events.on(solid_client_authn_core_1.EVENTS.SESSION_RESTORED, callback);
|
|
26546
|
+
/**
|
|
26547
|
+
* @hidden
|
|
26548
|
+
*/
|
|
26549
|
+
class OidcLoginHandler {
|
|
26550
|
+
constructor(storageUtility, oidcHandler, issuerConfigFetcher, clientRegistrar) {
|
|
26551
|
+
this.storageUtility = storageUtility;
|
|
26552
|
+
this.oidcHandler = oidcHandler;
|
|
26553
|
+
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
26554
|
+
this.clientRegistrar = clientRegistrar;
|
|
26555
|
+
this.storageUtility = storageUtility;
|
|
26556
|
+
this.oidcHandler = oidcHandler;
|
|
26557
|
+
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
26558
|
+
this.clientRegistrar = clientRegistrar;
|
|
26582
26559
|
}
|
|
26583
|
-
|
|
26584
|
-
|
|
26560
|
+
async canHandle(options) {
|
|
26561
|
+
return hasIssuer(options) && hasRedirectUrl(options);
|
|
26585
26562
|
}
|
|
26586
|
-
|
|
26587
|
-
|
|
26588
|
-
|
|
26589
|
-
|
|
26590
|
-
|
|
26591
|
-
|
|
26592
|
-
|
|
26593
|
-
|
|
26563
|
+
async handle(options) {
|
|
26564
|
+
if (!hasIssuer(options)) {
|
|
26565
|
+
throw new solidClientAuthnCore.ConfigurationError(`OidcLoginHandler requires an OIDC issuer: missing property 'oidcIssuer' in ${JSON.stringify(options)}`);
|
|
26566
|
+
}
|
|
26567
|
+
if (!hasRedirectUrl(options)) {
|
|
26568
|
+
throw new solidClientAuthnCore.ConfigurationError(`OidcLoginHandler requires a redirect URL: missing property 'redirectUrl' in ${JSON.stringify(options)}`);
|
|
26569
|
+
}
|
|
26570
|
+
// Fetch issuer config.
|
|
26571
|
+
const issuerConfig = await this.issuerConfigFetcher.fetchConfig(options.oidcIssuer);
|
|
26572
|
+
const clientRegistration = await solidClientAuthnCore.handleRegistration(options, issuerConfig, this.storageUtility, this.clientRegistrar);
|
|
26573
|
+
// Construct OIDC Options
|
|
26574
|
+
const OidcOptions = {
|
|
26575
|
+
// Note that here, the issuer is not the one from the received options, but
|
|
26576
|
+
// from the issuer's config. This enforces the canonical URL is used and stored,
|
|
26577
|
+
// which is also the one present in the ID token, so storing a technically
|
|
26578
|
+
// valid, but different issuer URL (e.g. using a trailing slash or not) now
|
|
26579
|
+
// could prevent from validating the ID token later.
|
|
26580
|
+
issuer: issuerConfig.issuer,
|
|
26581
|
+
// TODO: differentiate if DPoP should be true
|
|
26582
|
+
dpop: options.tokenType.toLowerCase() === "dpop",
|
|
26583
|
+
...options,
|
|
26584
|
+
issuerConfiguration: issuerConfig,
|
|
26585
|
+
client: clientRegistration,
|
|
26586
|
+
};
|
|
26587
|
+
// Call proper OIDC Handler
|
|
26588
|
+
return this.oidcHandler.handle(OidcOptions);
|
|
26594
26589
|
}
|
|
26595
26590
|
}
|
|
26596
|
-
exports.Session = Session;
|
|
26597
|
-
//# sourceMappingURL=Session.js.map
|
|
26598
|
-
|
|
26599
|
-
/***/ }),
|
|
26600
|
-
|
|
26601
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/constant.js":
|
|
26602
|
-
/*!**************************************************************************!*\
|
|
26603
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/constant.js ***!
|
|
26604
|
-
\**************************************************************************/
|
|
26605
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
26606
|
-
|
|
26607
|
-
"use strict";
|
|
26608
26591
|
|
|
26609
|
-
|
|
26610
|
-
|
|
26611
|
-
|
|
26612
|
-
|
|
26613
|
-
|
|
26614
|
-
|
|
26615
|
-
|
|
26616
|
-
|
|
26617
|
-
|
|
26618
|
-
|
|
26619
|
-
|
|
26620
|
-
|
|
26621
|
-
|
|
26622
|
-
|
|
26623
|
-
|
|
26624
|
-
|
|
26625
|
-
|
|
26626
|
-
|
|
26627
|
-
|
|
26628
|
-
|
|
26629
|
-
|
|
26630
|
-
|
|
26631
|
-
|
|
26632
|
-
|
|
26633
|
-
|
|
26634
|
-
|
|
26635
|
-
|
|
26636
|
-
|
|
26637
|
-
|
|
26638
|
-
|
|
26639
|
-
|
|
26640
|
-
|
|
26641
|
-
|
|
26642
|
-
|
|
26643
|
-
|
|
26644
|
-
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
26656
|
-
exports.handleIncomingRedirect = handleIncomingRedirect;
|
|
26657
|
-
const onLogin = (...args) => {
|
|
26658
|
-
const session = getDefaultSession();
|
|
26659
|
-
return session.onLogin(...args);
|
|
26660
|
-
};
|
|
26661
|
-
exports.onLogin = onLogin;
|
|
26662
|
-
const onLogout = (...args) => {
|
|
26663
|
-
const session = getDefaultSession();
|
|
26664
|
-
return session.onLogout(...args);
|
|
26665
|
-
};
|
|
26666
|
-
exports.onLogout = onLogout;
|
|
26667
|
-
const onSessionRestore = (...args) => {
|
|
26668
|
-
const session = getDefaultSession();
|
|
26669
|
-
return session.onSessionRestore(...args);
|
|
26670
|
-
};
|
|
26671
|
-
exports.onSessionRestore = onSessionRestore;
|
|
26672
|
-
const events = () => {
|
|
26673
|
-
return getDefaultSession().events;
|
|
26674
|
-
};
|
|
26675
|
-
exports.events = events;
|
|
26676
|
-
//# sourceMappingURL=defaultSession.js.map
|
|
26677
|
-
|
|
26678
|
-
/***/ }),
|
|
26679
|
-
|
|
26680
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/dependencies.js":
|
|
26681
|
-
/*!******************************************************************************!*\
|
|
26682
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/dependencies.js ***!
|
|
26683
|
-
\******************************************************************************/
|
|
26684
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
26685
|
-
|
|
26686
|
-
"use strict";
|
|
26687
|
-
|
|
26688
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26689
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26690
|
-
};
|
|
26691
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26692
|
-
exports.getClientAuthenticationWithDependencies = void 0;
|
|
26693
|
-
const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
|
|
26694
|
-
const StorageUtility_1 = __importDefault(__webpack_require__(/*! ./storage/StorageUtility */ "./node_modules/@inrupt/solid-client-authn-browser/dist/storage/StorageUtility.js"));
|
|
26695
|
-
const ClientAuthentication_1 = __importDefault(__webpack_require__(/*! ./ClientAuthentication */ "./node_modules/@inrupt/solid-client-authn-browser/dist/ClientAuthentication.js"));
|
|
26696
|
-
const OidcLoginHandler_1 = __importDefault(__webpack_require__(/*! ./login/oidc/OidcLoginHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/OidcLoginHandler.js"));
|
|
26697
|
-
const AuthorizationCodeWithPkceOidcHandler_1 = __importDefault(__webpack_require__(/*! ./login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js"));
|
|
26698
|
-
const IssuerConfigFetcher_1 = __importDefault(__webpack_require__(/*! ./login/oidc/IssuerConfigFetcher */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/IssuerConfigFetcher.js"));
|
|
26699
|
-
const FallbackRedirectHandler_1 = __webpack_require__(/*! ./login/oidc/incomingRedirectHandler/FallbackRedirectHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.js");
|
|
26700
|
-
const GeneralLogoutHandler_1 = __importDefault(__webpack_require__(/*! ./logout/GeneralLogoutHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/logout/GeneralLogoutHandler.js"));
|
|
26701
|
-
const SessionInfoManager_1 = __webpack_require__(/*! ./sessionInfo/SessionInfoManager */ "./node_modules/@inrupt/solid-client-authn-browser/dist/sessionInfo/SessionInfoManager.js");
|
|
26702
|
-
const AuthCodeRedirectHandler_1 = __webpack_require__(/*! ./login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.js");
|
|
26703
|
-
const AggregateRedirectHandler_1 = __importDefault(__webpack_require__(/*! ./login/oidc/AggregateRedirectHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/AggregateRedirectHandler.js"));
|
|
26704
|
-
const BrowserStorage_1 = __importDefault(__webpack_require__(/*! ./storage/BrowserStorage */ "./node_modules/@inrupt/solid-client-authn-browser/dist/storage/BrowserStorage.js"));
|
|
26705
|
-
const Redirector_1 = __importDefault(__webpack_require__(/*! ./login/oidc/Redirector */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/Redirector.js"));
|
|
26706
|
-
const ClientRegistrar_1 = __importDefault(__webpack_require__(/*! ./login/oidc/ClientRegistrar */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/ClientRegistrar.js"));
|
|
26707
|
-
const ErrorOidcHandler_1 = __webpack_require__(/*! ./login/oidc/incomingRedirectHandler/ErrorOidcHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.js");
|
|
26708
|
-
const TokenRefresher_1 = __importDefault(__webpack_require__(/*! ./login/oidc/refresh/TokenRefresher */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/refresh/TokenRefresher.js"));
|
|
26709
|
-
function getClientAuthenticationWithDependencies(dependencies) {
|
|
26710
|
-
const inMemoryStorage = new solid_client_authn_core_1.InMemoryStorage();
|
|
26711
|
-
const secureStorage = dependencies.secureStorage || inMemoryStorage;
|
|
26712
|
-
const insecureStorage = dependencies.insecureStorage || new BrowserStorage_1.default();
|
|
26713
|
-
const storageUtility = new StorageUtility_1.default(secureStorage, insecureStorage);
|
|
26714
|
-
const issuerConfigFetcher = new IssuerConfigFetcher_1.default(storageUtility);
|
|
26715
|
-
const clientRegistrar = new ClientRegistrar_1.default(storageUtility);
|
|
26716
|
-
const sessionInfoManager = new SessionInfoManager_1.SessionInfoManager(storageUtility);
|
|
26717
|
-
const tokenRefresher = new TokenRefresher_1.default(storageUtility, issuerConfigFetcher, clientRegistrar);
|
|
26718
|
-
const loginHandler = new OidcLoginHandler_1.default(storageUtility, new AuthorizationCodeWithPkceOidcHandler_1.default(storageUtility, new Redirector_1.default()), issuerConfigFetcher, clientRegistrar);
|
|
26719
|
-
const redirectHandler = new AggregateRedirectHandler_1.default([
|
|
26720
|
-
new ErrorOidcHandler_1.ErrorOidcHandler(),
|
|
26721
|
-
new AuthCodeRedirectHandler_1.AuthCodeRedirectHandler(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokenRefresher),
|
|
26722
|
-
new FallbackRedirectHandler_1.FallbackRedirectHandler(),
|
|
26723
|
-
]);
|
|
26724
|
-
return new ClientAuthentication_1.default(loginHandler, redirectHandler, new GeneralLogoutHandler_1.default(sessionInfoManager), sessionInfoManager, issuerConfigFetcher);
|
|
26725
|
-
}
|
|
26726
|
-
exports.getClientAuthenticationWithDependencies = getClientAuthenticationWithDependencies;
|
|
26727
|
-
//# sourceMappingURL=dependencies.js.map
|
|
26728
|
-
|
|
26729
|
-
/***/ }),
|
|
26730
|
-
|
|
26731
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/index.js":
|
|
26732
|
-
/*!***********************************************************************!*\
|
|
26733
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/index.js ***!
|
|
26734
|
-
\***********************************************************************/
|
|
26735
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
26736
|
-
|
|
26737
|
-
"use strict";
|
|
26738
|
-
|
|
26739
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
26740
|
-
if (k2 === undefined) k2 = k;
|
|
26741
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26742
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26743
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26744
|
-
}
|
|
26745
|
-
Object.defineProperty(o, k2, desc);
|
|
26746
|
-
}) : (function(o, m, k, k2) {
|
|
26747
|
-
if (k2 === undefined) k2 = k;
|
|
26748
|
-
o[k2] = m[k];
|
|
26749
|
-
}));
|
|
26750
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26751
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26752
|
-
};
|
|
26753
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26754
|
-
exports.EVENTS = exports.InMemoryStorage = exports.ConfigurationError = exports.NotImplementedError = exports.getClientAuthenticationWithDependencies = exports.Session = void 0;
|
|
26755
|
-
var Session_1 = __webpack_require__(/*! ./Session */ "./node_modules/@inrupt/solid-client-authn-browser/dist/Session.js");
|
|
26756
|
-
Object.defineProperty(exports, "Session", ({ enumerable: true, get: function () { return Session_1.Session; } }));
|
|
26757
|
-
var dependencies_1 = __webpack_require__(/*! ./dependencies */ "./node_modules/@inrupt/solid-client-authn-browser/dist/dependencies.js");
|
|
26758
|
-
Object.defineProperty(exports, "getClientAuthenticationWithDependencies", ({ enumerable: true, get: function () { return dependencies_1.getClientAuthenticationWithDependencies; } }));
|
|
26759
|
-
__exportStar(__webpack_require__(/*! ./defaultSession */ "./node_modules/@inrupt/solid-client-authn-browser/dist/defaultSession.js"), exports);
|
|
26760
|
-
var solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
|
|
26761
|
-
Object.defineProperty(exports, "NotImplementedError", ({ enumerable: true, get: function () { return solid_client_authn_core_1.NotImplementedError; } }));
|
|
26762
|
-
Object.defineProperty(exports, "ConfigurationError", ({ enumerable: true, get: function () { return solid_client_authn_core_1.ConfigurationError; } }));
|
|
26763
|
-
Object.defineProperty(exports, "InMemoryStorage", ({ enumerable: true, get: function () { return solid_client_authn_core_1.InMemoryStorage; } }));
|
|
26764
|
-
Object.defineProperty(exports, "EVENTS", ({ enumerable: true, get: function () { return solid_client_authn_core_1.EVENTS; } }));
|
|
26765
|
-
//# sourceMappingURL=index.js.map
|
|
26766
|
-
|
|
26767
|
-
/***/ }),
|
|
26768
|
-
|
|
26769
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/AggregateRedirectHandler.js":
|
|
26770
|
-
/*!*****************************************************************************************************!*\
|
|
26771
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/AggregateRedirectHandler.js ***!
|
|
26772
|
-
\*****************************************************************************************************/
|
|
26773
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
26774
|
-
|
|
26775
|
-
"use strict";
|
|
26776
|
-
|
|
26777
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26778
|
-
const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
|
|
26779
|
-
class AggregateRedirectHandler extends solid_client_authn_core_1.AggregateHandler {
|
|
26780
|
-
constructor(redirectHandlers) {
|
|
26781
|
-
super(redirectHandlers);
|
|
26782
|
-
}
|
|
26783
|
-
}
|
|
26784
|
-
exports["default"] = AggregateRedirectHandler;
|
|
26785
|
-
//# sourceMappingURL=AggregateRedirectHandler.js.map
|
|
26786
|
-
|
|
26787
|
-
/***/ }),
|
|
26788
|
-
|
|
26789
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/ClientRegistrar.js":
|
|
26790
|
-
/*!********************************************************************************************!*\
|
|
26791
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/ClientRegistrar.js ***!
|
|
26792
|
-
\********************************************************************************************/
|
|
26793
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
26794
|
-
|
|
26795
|
-
"use strict";
|
|
26796
|
-
|
|
26797
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26798
|
-
const oidc_client_ext_1 = __webpack_require__(/*! @inrupt/oidc-client-ext */ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js");
|
|
26799
|
-
class ClientRegistrar {
|
|
26800
|
-
constructor(storageUtility) {
|
|
26801
|
-
this.storageUtility = storageUtility;
|
|
26802
|
-
}
|
|
26803
|
-
async getClient(options, issuerConfig) {
|
|
26804
|
-
const [storedClientId, storedClientSecret,] = await Promise.all([
|
|
26805
|
-
this.storageUtility.getForUser(options.sessionId, "clientId", {
|
|
26806
|
-
secure: false,
|
|
26807
|
-
}),
|
|
26808
|
-
this.storageUtility.getForUser(options.sessionId, "clientSecret", {
|
|
26809
|
-
secure: false,
|
|
26810
|
-
}),
|
|
26811
|
-
]);
|
|
26812
|
-
if (storedClientId) {
|
|
26813
|
-
return {
|
|
26814
|
-
clientId: storedClientId,
|
|
26815
|
-
clientSecret: storedClientSecret,
|
|
26816
|
-
clientType: "dynamic",
|
|
26817
|
-
};
|
|
26818
|
-
}
|
|
26592
|
+
//
|
|
26593
|
+
// Copyright Inrupt Inc.
|
|
26594
|
+
//
|
|
26595
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26596
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
26597
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
26598
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
26599
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
26600
|
+
// subject to the following conditions:
|
|
26601
|
+
//
|
|
26602
|
+
// The above copyright notice and this permission notice shall be included in
|
|
26603
|
+
// all copies or substantial portions of the Software.
|
|
26604
|
+
//
|
|
26605
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
26606
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
26607
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26608
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26609
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
26610
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26611
|
+
//
|
|
26612
|
+
/**
|
|
26613
|
+
* @hidden
|
|
26614
|
+
* Authorization code flow spec: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth
|
|
26615
|
+
* PKCE: https://tools.ietf.org/html/rfc7636
|
|
26616
|
+
*/
|
|
26617
|
+
class AuthorizationCodeWithPkceOidcHandler extends solidClientAuthnCore.AuthorizationCodeWithPkceOidcHandlerBase {
|
|
26618
|
+
async handle(oidcLoginOptions) {
|
|
26619
|
+
var _a;
|
|
26620
|
+
/* eslint-disable camelcase */
|
|
26621
|
+
const oidcOptions = {
|
|
26622
|
+
authority: oidcLoginOptions.issuer.toString(),
|
|
26623
|
+
client_id: oidcLoginOptions.client.clientId,
|
|
26624
|
+
client_secret: oidcLoginOptions.client.clientSecret,
|
|
26625
|
+
redirect_uri: oidcLoginOptions.redirectUrl.toString(),
|
|
26626
|
+
post_logout_redirect_uri: oidcLoginOptions.redirectUrl.toString(),
|
|
26627
|
+
response_type: "code",
|
|
26628
|
+
scope: solidClientAuthnCore.DEFAULT_SCOPES,
|
|
26629
|
+
filterProtocolClaims: true,
|
|
26630
|
+
// The userinfo endpoint on NSS fails, so disable this for now
|
|
26631
|
+
// Note that in Solid, information should be retrieved from the
|
|
26632
|
+
// profile referenced by the WebId.
|
|
26633
|
+
loadUserInfo: false,
|
|
26634
|
+
code_verifier: true,
|
|
26635
|
+
prompt: (_a = oidcLoginOptions.prompt) !== null && _a !== void 0 ? _a : "consent",
|
|
26636
|
+
};
|
|
26637
|
+
/* eslint-enable camelcase */
|
|
26638
|
+
const oidcClientLibrary = new oidcClientExt.OidcClient(oidcOptions);
|
|
26819
26639
|
try {
|
|
26820
|
-
const
|
|
26821
|
-
|
|
26822
|
-
|
|
26823
|
-
|
|
26824
|
-
|
|
26825
|
-
|
|
26826
|
-
|
|
26827
|
-
|
|
26828
|
-
|
|
26829
|
-
registeredClient.idTokenSignedResponseAlg;
|
|
26830
|
-
}
|
|
26831
|
-
await this.storageUtility.setForUser(options.sessionId, infoToSave, {
|
|
26832
|
-
secure: false,
|
|
26640
|
+
const signingRequest = await oidcClientLibrary.createSigninRequest();
|
|
26641
|
+
// Make sure to await the promise before returning so that the error is caught.
|
|
26642
|
+
return await this.handleRedirect({
|
|
26643
|
+
oidcLoginOptions,
|
|
26644
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
26645
|
+
state: signingRequest.state._id,
|
|
26646
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
26647
|
+
codeVerifier: signingRequest.state._code_verifier,
|
|
26648
|
+
targetUrl: signingRequest.url.toString(),
|
|
26833
26649
|
});
|
|
26834
|
-
return registeredClient;
|
|
26835
26650
|
}
|
|
26836
|
-
catch (
|
|
26837
|
-
|
|
26651
|
+
catch (err) {
|
|
26652
|
+
// eslint-disable-next-line no-console
|
|
26653
|
+
console.error(err);
|
|
26838
26654
|
}
|
|
26655
|
+
// The login is only completed AFTER redirect, so nothing to return here.
|
|
26656
|
+
return undefined;
|
|
26839
26657
|
}
|
|
26840
26658
|
}
|
|
26841
|
-
exports["default"] = ClientRegistrar;
|
|
26842
|
-
//# sourceMappingURL=ClientRegistrar.js.map
|
|
26843
|
-
|
|
26844
|
-
/***/ }),
|
|
26845
|
-
|
|
26846
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/IssuerConfigFetcher.js":
|
|
26847
|
-
/*!************************************************************************************************!*\
|
|
26848
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/IssuerConfigFetcher.js ***!
|
|
26849
|
-
\************************************************************************************************/
|
|
26850
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
26851
|
-
|
|
26852
|
-
"use strict";
|
|
26853
26659
|
|
|
26854
|
-
|
|
26855
|
-
|
|
26856
|
-
|
|
26857
|
-
|
|
26858
|
-
|
|
26660
|
+
//
|
|
26661
|
+
// Copyright Inrupt Inc.
|
|
26662
|
+
//
|
|
26663
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26664
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
26665
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
26666
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
26667
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
26668
|
+
// subject to the following conditions:
|
|
26669
|
+
//
|
|
26670
|
+
// The above copyright notice and this permission notice shall be included in
|
|
26671
|
+
// all copies or substantial portions of the Software.
|
|
26672
|
+
//
|
|
26673
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
26674
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
26675
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26676
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26677
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
26678
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26679
|
+
//
|
|
26680
|
+
const WELL_KNOWN_OPENID_CONFIG = ".well-known/openid-configuration";
|
|
26681
|
+
/* eslint-disable camelcase */
|
|
26859
26682
|
const issuerConfigKeyMap = {
|
|
26860
26683
|
issuer: {
|
|
26861
26684
|
toKey: "issuer",
|
|
@@ -26881,6 +26704,10 @@ const issuerConfigKeyMap = {
|
|
|
26881
26704
|
toKey: "registrationEndpoint",
|
|
26882
26705
|
convertToUrl: true,
|
|
26883
26706
|
},
|
|
26707
|
+
end_session_endpoint: {
|
|
26708
|
+
toKey: "endSessionEndpoint",
|
|
26709
|
+
convertToUrl: true,
|
|
26710
|
+
},
|
|
26884
26711
|
scopes_supported: { toKey: "scopesSupported" },
|
|
26885
26712
|
response_types_supported: { toKey: "responseTypesSupported" },
|
|
26886
26713
|
response_modes_supported: { toKey: "responseModesSupported" },
|
|
@@ -26939,10 +26766,15 @@ const issuerConfigKeyMap = {
|
|
|
26939
26766
|
convertToUrl: true,
|
|
26940
26767
|
},
|
|
26941
26768
|
};
|
|
26769
|
+
/* eslint-enable camelcase */
|
|
26942
26770
|
function processConfig(config) {
|
|
26943
26771
|
const parsedConfig = {};
|
|
26944
26772
|
Object.keys(config).forEach((key) => {
|
|
26945
26773
|
if (issuerConfigKeyMap[key]) {
|
|
26774
|
+
// TODO: PMcB55: Validate URL if "issuerConfigKeyMap[key].convertToUrl"
|
|
26775
|
+
// if (issuerConfigKeyMap[key].convertToUrl) {
|
|
26776
|
+
// validateUrl(config[key]);
|
|
26777
|
+
// }
|
|
26946
26778
|
parsedConfig[issuerConfigKeyMap[key].toKey] = config[key];
|
|
26947
26779
|
}
|
|
26948
26780
|
});
|
|
@@ -26951,122 +26783,218 @@ function processConfig(config) {
|
|
|
26951
26783
|
}
|
|
26952
26784
|
return parsedConfig;
|
|
26953
26785
|
}
|
|
26786
|
+
/**
|
|
26787
|
+
* @hidden
|
|
26788
|
+
*/
|
|
26954
26789
|
class IssuerConfigFetcher {
|
|
26955
26790
|
constructor(storageUtility) {
|
|
26956
26791
|
this.storageUtility = storageUtility;
|
|
26792
|
+
this.storageUtility = storageUtility;
|
|
26957
26793
|
}
|
|
26794
|
+
// This method needs no state (so can be static), and can be exposed to allow
|
|
26795
|
+
// callers to know where this implementation puts state it needs.
|
|
26958
26796
|
static getLocalStorageKey(issuer) {
|
|
26959
26797
|
return `issuerConfig:${issuer}`;
|
|
26960
26798
|
}
|
|
26961
26799
|
async fetchConfig(issuer) {
|
|
26962
26800
|
let issuerConfig;
|
|
26963
|
-
const openIdConfigUrl = new URL(
|
|
26964
|
-
|
|
26801
|
+
const openIdConfigUrl = new URL(WELL_KNOWN_OPENID_CONFIG,
|
|
26802
|
+
// Make sure to append a slash at issuer URL, so that the .well-known URL
|
|
26803
|
+
// includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.
|
|
26804
|
+
issuer.endsWith("/") ? issuer : `${issuer}/`).href;
|
|
26805
|
+
const issuerConfigRequestBody = await universalFetch.fetch.call(globalThis, openIdConfigUrl);
|
|
26806
|
+
// Check the validity of the fetched config
|
|
26965
26807
|
try {
|
|
26966
26808
|
issuerConfig = processConfig(await issuerConfigRequestBody.json());
|
|
26967
26809
|
}
|
|
26968
26810
|
catch (err) {
|
|
26969
|
-
throw new
|
|
26811
|
+
throw new solidClientAuthnCore.ConfigurationError(`[${issuer.toString()}] has an invalid configuration: ${err.message}`);
|
|
26970
26812
|
}
|
|
26813
|
+
// Update store with fetched config
|
|
26971
26814
|
await this.storageUtility.set(IssuerConfigFetcher.getLocalStorageKey(issuer), JSON.stringify(issuerConfig));
|
|
26972
26815
|
return issuerConfig;
|
|
26973
26816
|
}
|
|
26974
26817
|
}
|
|
26975
|
-
exports["default"] = IssuerConfigFetcher;
|
|
26976
|
-
//# sourceMappingURL=IssuerConfigFetcher.js.map
|
|
26977
26818
|
|
|
26978
|
-
|
|
26979
|
-
|
|
26980
|
-
|
|
26981
|
-
|
|
26982
|
-
|
|
26983
|
-
|
|
26984
|
-
|
|
26985
|
-
|
|
26986
|
-
|
|
26987
|
-
|
|
26988
|
-
|
|
26989
|
-
|
|
26990
|
-
|
|
26991
|
-
|
|
26992
|
-
|
|
26993
|
-
|
|
26994
|
-
|
|
26995
|
-
|
|
26996
|
-
|
|
26997
|
-
|
|
26998
|
-
|
|
26999
|
-
|
|
27000
|
-
|
|
27001
|
-
|
|
27002
|
-
|
|
27003
|
-
|
|
27004
|
-
|
|
27005
|
-
|
|
27006
|
-
|
|
27007
|
-
|
|
27008
|
-
|
|
26819
|
+
//
|
|
26820
|
+
// Copyright Inrupt Inc.
|
|
26821
|
+
//
|
|
26822
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26823
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
26824
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
26825
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
26826
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
26827
|
+
// subject to the following conditions:
|
|
26828
|
+
//
|
|
26829
|
+
// The above copyright notice and this permission notice shall be included in
|
|
26830
|
+
// all copies or substantial portions of the Software.
|
|
26831
|
+
//
|
|
26832
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
26833
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
26834
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26835
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26836
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
26837
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26838
|
+
//
|
|
26839
|
+
/**
|
|
26840
|
+
* @param sessionId
|
|
26841
|
+
* @param storage
|
|
26842
|
+
* @hidden
|
|
26843
|
+
*/
|
|
26844
|
+
async function clear(sessionId, storage) {
|
|
26845
|
+
await solidClientAuthnCore.clear(sessionId, storage);
|
|
26846
|
+
await oidcClientExt.clearOidcPersistentStorage();
|
|
26847
|
+
}
|
|
26848
|
+
/**
|
|
26849
|
+
* @hidden
|
|
26850
|
+
*/
|
|
26851
|
+
class SessionInfoManager extends solidClientAuthnCore.SessionInfoManagerBase {
|
|
26852
|
+
async get(sessionId) {
|
|
26853
|
+
const [isLoggedIn, webId, clientId, clientSecret, redirectUrl, refreshToken, issuer, tokenType,] = await Promise.all([
|
|
26854
|
+
this.storageUtility.getForUser(sessionId, "isLoggedIn", {
|
|
26855
|
+
secure: true,
|
|
26856
|
+
}),
|
|
26857
|
+
this.storageUtility.getForUser(sessionId, "webId", {
|
|
26858
|
+
secure: true,
|
|
26859
|
+
}),
|
|
26860
|
+
this.storageUtility.getForUser(sessionId, "clientId", {
|
|
26861
|
+
secure: false,
|
|
26862
|
+
}),
|
|
26863
|
+
this.storageUtility.getForUser(sessionId, "clientSecret", {
|
|
26864
|
+
secure: false,
|
|
26865
|
+
}),
|
|
26866
|
+
this.storageUtility.getForUser(sessionId, "redirectUrl", {
|
|
26867
|
+
secure: false,
|
|
26868
|
+
}),
|
|
26869
|
+
this.storageUtility.getForUser(sessionId, "refreshToken", {
|
|
26870
|
+
secure: true,
|
|
26871
|
+
}),
|
|
26872
|
+
this.storageUtility.getForUser(sessionId, "issuer", {
|
|
26873
|
+
secure: false,
|
|
26874
|
+
}),
|
|
26875
|
+
this.storageUtility.getForUser(sessionId, "tokenType", {
|
|
26876
|
+
secure: false,
|
|
26877
|
+
}),
|
|
26878
|
+
]);
|
|
26879
|
+
if (typeof redirectUrl === "string" && !solidClientAuthnCore.isValidRedirectUrl(redirectUrl)) {
|
|
26880
|
+
// This resolves the issue for people experiencing https://github.com/inrupt/solid-client-authn-js/issues/2891.
|
|
26881
|
+
// An invalid redirect URL is present in the storage, and the session should
|
|
26882
|
+
// be cleared to get a fresh start. This will require the user to log back in.
|
|
26883
|
+
await Promise.all([
|
|
26884
|
+
this.storageUtility.deleteAllUserData(sessionId, { secure: false }),
|
|
26885
|
+
this.storageUtility.deleteAllUserData(sessionId, { secure: true }),
|
|
26886
|
+
]);
|
|
26887
|
+
return undefined;
|
|
27009
26888
|
}
|
|
27010
|
-
if (!
|
|
27011
|
-
throw new
|
|
26889
|
+
if (tokenType !== undefined && !solidClientAuthnCore.isSupportedTokenType(tokenType)) {
|
|
26890
|
+
throw new Error(`Tokens of type [${tokenType}] are not supported.`);
|
|
27012
26891
|
}
|
|
27013
|
-
|
|
27014
|
-
|
|
27015
|
-
|
|
27016
|
-
|
|
27017
|
-
|
|
27018
|
-
|
|
27019
|
-
|
|
27020
|
-
|
|
26892
|
+
if (clientId === undefined &&
|
|
26893
|
+
isLoggedIn === undefined &&
|
|
26894
|
+
webId === undefined &&
|
|
26895
|
+
refreshToken === undefined) {
|
|
26896
|
+
return undefined;
|
|
26897
|
+
}
|
|
26898
|
+
return {
|
|
26899
|
+
sessionId,
|
|
26900
|
+
webId,
|
|
26901
|
+
isLoggedIn: isLoggedIn === "true",
|
|
26902
|
+
redirectUrl,
|
|
26903
|
+
refreshToken,
|
|
26904
|
+
issuer,
|
|
26905
|
+
clientAppId: clientId,
|
|
26906
|
+
clientAppSecret: clientSecret,
|
|
26907
|
+
// Default the token type to DPoP if unspecified.
|
|
26908
|
+
tokenType: tokenType !== null && tokenType !== void 0 ? tokenType : "DPoP",
|
|
27021
26909
|
};
|
|
27022
|
-
|
|
26910
|
+
}
|
|
26911
|
+
/**
|
|
26912
|
+
* This function removes all session-related information from storage.
|
|
26913
|
+
* @param sessionId the session identifier
|
|
26914
|
+
* @param storage the storage where session info is stored
|
|
26915
|
+
* @hidden
|
|
26916
|
+
*/
|
|
26917
|
+
async clear(sessionId) {
|
|
26918
|
+
return clear(sessionId, this.storageUtility);
|
|
27023
26919
|
}
|
|
27024
26920
|
}
|
|
27025
|
-
exports["default"] = OidcLoginHandler;
|
|
27026
|
-
//# sourceMappingURL=OidcLoginHandler.js.map
|
|
27027
|
-
|
|
27028
|
-
/***/ }),
|
|
27029
|
-
|
|
27030
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/Redirector.js":
|
|
27031
|
-
/*!***************************************************************************************!*\
|
|
27032
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/Redirector.js ***!
|
|
27033
|
-
\***************************************************************************************/
|
|
27034
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
27035
|
-
|
|
27036
|
-
"use strict";
|
|
27037
26921
|
|
|
27038
|
-
|
|
27039
|
-
|
|
27040
|
-
|
|
27041
|
-
|
|
27042
|
-
|
|
27043
|
-
|
|
27044
|
-
|
|
27045
|
-
|
|
26922
|
+
//
|
|
26923
|
+
// Copyright Inrupt Inc.
|
|
26924
|
+
//
|
|
26925
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26926
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
26927
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
26928
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
26929
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
26930
|
+
// subject to the following conditions:
|
|
26931
|
+
//
|
|
26932
|
+
// The above copyright notice and this permission notice shall be included in
|
|
26933
|
+
// all copies or substantial portions of the Software.
|
|
26934
|
+
//
|
|
26935
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
26936
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
26937
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26938
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26939
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
26940
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26941
|
+
//
|
|
26942
|
+
/**
|
|
26943
|
+
* This class handles redirect IRIs without any query params, and returns an unauthenticated
|
|
26944
|
+
* session. It serves as a fallback so that consuming libraries don't have to test
|
|
26945
|
+
* for the query params themselves, and can always try to use them as a redirect IRI.
|
|
26946
|
+
* @hidden
|
|
26947
|
+
*/
|
|
26948
|
+
class FallbackRedirectHandler {
|
|
26949
|
+
async canHandle(redirectUrl) {
|
|
26950
|
+
try {
|
|
26951
|
+
// The next URL object is built for validating it.
|
|
26952
|
+
// eslint-disable-next-line no-new
|
|
26953
|
+
new URL(redirectUrl);
|
|
26954
|
+
return true;
|
|
27046
26955
|
}
|
|
27047
|
-
|
|
27048
|
-
|
|
26956
|
+
catch (e) {
|
|
26957
|
+
throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);
|
|
27049
26958
|
}
|
|
27050
26959
|
}
|
|
26960
|
+
async handle(
|
|
26961
|
+
// The argument is ignored, but must be present to implement the interface
|
|
26962
|
+
_redirectUrl) {
|
|
26963
|
+
return solidClientAuthnCore.getUnauthenticatedSession();
|
|
26964
|
+
}
|
|
27051
26965
|
}
|
|
27052
|
-
exports["default"] = Redirector;
|
|
27053
|
-
//# sourceMappingURL=Redirector.js.map
|
|
27054
|
-
|
|
27055
|
-
/***/ }),
|
|
27056
|
-
|
|
27057
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.js":
|
|
27058
|
-
/*!****************************************************************************************************************************!*\
|
|
27059
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.js ***!
|
|
27060
|
-
\****************************************************************************************************************************/
|
|
27061
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
27062
|
-
|
|
27063
|
-
"use strict";
|
|
27064
26966
|
|
|
27065
|
-
|
|
27066
|
-
|
|
27067
|
-
|
|
27068
|
-
|
|
27069
|
-
|
|
26967
|
+
//
|
|
26968
|
+
// Copyright Inrupt Inc.
|
|
26969
|
+
//
|
|
26970
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26971
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
26972
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
26973
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
26974
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
26975
|
+
// subject to the following conditions:
|
|
26976
|
+
//
|
|
26977
|
+
// The above copyright notice and this permission notice shall be included in
|
|
26978
|
+
// all copies or substantial portions of the Software.
|
|
26979
|
+
//
|
|
26980
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
26981
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
26982
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26983
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26984
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
26985
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26986
|
+
//
|
|
26987
|
+
/**
|
|
26988
|
+
* @hidden
|
|
26989
|
+
* @packageDocumentation
|
|
26990
|
+
*/
|
|
26991
|
+
// FIXME: The following doesn't work in the browser, it results in all the fetches
|
|
26992
|
+
// being unauthenticated. This should be looked into when migrating to universal-fetch.
|
|
26993
|
+
// import { fetch } from "cross-fetch";
|
|
26994
|
+
const globalFetch = (...args) => universalFetch.fetch.call(globalThis, ...args);
|
|
26995
|
+
/**
|
|
26996
|
+
* @hidden
|
|
26997
|
+
*/
|
|
27070
26998
|
class AuthCodeRedirectHandler {
|
|
27071
26999
|
constructor(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokerRefresher) {
|
|
27072
27000
|
this.storageUtility = storageUtility;
|
|
@@ -27074,6 +27002,11 @@ class AuthCodeRedirectHandler {
|
|
|
27074
27002
|
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
27075
27003
|
this.clientRegistrar = clientRegistrar;
|
|
27076
27004
|
this.tokerRefresher = tokerRefresher;
|
|
27005
|
+
this.storageUtility = storageUtility;
|
|
27006
|
+
this.sessionInfoManager = sessionInfoManager;
|
|
27007
|
+
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
27008
|
+
this.clientRegistrar = clientRegistrar;
|
|
27009
|
+
this.tokerRefresher = tokerRefresher;
|
|
27077
27010
|
}
|
|
27078
27011
|
async canHandle(redirectUrl) {
|
|
27079
27012
|
try {
|
|
@@ -27094,7 +27027,7 @@ class AuthCodeRedirectHandler {
|
|
|
27094
27027
|
const storedSessionId = (await this.storageUtility.getForUser(oauthState, "sessionId", {
|
|
27095
27028
|
errorIfNull: true,
|
|
27096
27029
|
}));
|
|
27097
|
-
const { issuerConfig, codeVerifier, redirectUrl: storedRedirectIri, dpop: isDpop, } = await
|
|
27030
|
+
const { issuerConfig, codeVerifier, redirectUrl: storedRedirectIri, dpop: isDpop, } = await solidClientAuthnCore.loadOidcContextFromStorage(storedSessionId, this.storageUtility, this.issuerConfigFetcher);
|
|
27098
27031
|
const iss = url.searchParams.get("iss");
|
|
27099
27032
|
if (typeof iss === "string" && iss !== issuerConfig.issuer) {
|
|
27100
27033
|
throw new Error(`The value of the iss parameter (${iss}) does not match the issuer identifier of the authorization server (${issuerConfig.issuer}). See [rfc9207](https://www.rfc-editor.org/rfc/rfc9207.html#section-2.3-3.1.1)`);
|
|
@@ -27109,16 +27042,21 @@ class AuthCodeRedirectHandler {
|
|
|
27109
27042
|
let tokens;
|
|
27110
27043
|
const tokenCreatedAt = Date.now();
|
|
27111
27044
|
if (isDpop) {
|
|
27112
|
-
tokens = await
|
|
27045
|
+
tokens = await oidcClientExt.getDpopToken(issuerConfig, client, {
|
|
27113
27046
|
grantType: "authorization_code",
|
|
27047
|
+
// We rely on our 'canHandle' function checking that the OAuth 'code'
|
|
27048
|
+
// parameter is present in our query string.
|
|
27114
27049
|
code: url.searchParams.get("code"),
|
|
27115
27050
|
codeVerifier,
|
|
27116
27051
|
redirectUrl: storedRedirectIri,
|
|
27117
27052
|
});
|
|
27053
|
+
// Delete oidc-client-specific session information from storage. This is
|
|
27054
|
+
// done automatically when retrieving a bearer token, but since the DPoP
|
|
27055
|
+
// binding uses our custom code, this needs to be done manually.
|
|
27118
27056
|
window.localStorage.removeItem(`oidc.${oauthState}`);
|
|
27119
27057
|
}
|
|
27120
27058
|
else {
|
|
27121
|
-
tokens = await
|
|
27059
|
+
tokens = await oidcClientExt.getBearerToken(url.toString());
|
|
27122
27060
|
}
|
|
27123
27061
|
let refreshOptions;
|
|
27124
27062
|
if (tokens.refreshToken !== undefined) {
|
|
@@ -27128,7 +27066,7 @@ class AuthCodeRedirectHandler {
|
|
|
27128
27066
|
tokenRefresher: this.tokerRefresher,
|
|
27129
27067
|
};
|
|
27130
27068
|
}
|
|
27131
|
-
const authFetch = await
|
|
27069
|
+
const authFetch = await solidClientAuthnCore.buildAuthenticatedFetch(globalFetch, tokens.accessToken, {
|
|
27132
27070
|
dpopKey: tokens.dpopKey,
|
|
27133
27071
|
refreshOptions,
|
|
27134
27072
|
eventEmitter,
|
|
@@ -27144,178 +27082,295 @@ class AuthCodeRedirectHandler {
|
|
|
27144
27082
|
}
|
|
27145
27083
|
return Object.assign(sessionInfo, {
|
|
27146
27084
|
fetch: authFetch,
|
|
27085
|
+
getLogoutUrl: solidClientAuthnCore.maybeBuildRpInitiatedLogout({
|
|
27086
|
+
idTokenHint: tokens.idToken,
|
|
27087
|
+
endSessionEndpoint: issuerConfig.endSessionEndpoint,
|
|
27088
|
+
}),
|
|
27147
27089
|
expirationDate: typeof tokens.expiresIn === "number"
|
|
27148
27090
|
? tokenCreatedAt + tokens.expiresIn * 1000
|
|
27149
|
-
:
|
|
27091
|
+
: undefined,
|
|
27150
27092
|
});
|
|
27151
27093
|
}
|
|
27152
27094
|
}
|
|
27153
|
-
exports.AuthCodeRedirectHandler = AuthCodeRedirectHandler;
|
|
27154
|
-
//# sourceMappingURL=AuthCodeRedirectHandler.js.map
|
|
27155
|
-
|
|
27156
|
-
/***/ }),
|
|
27157
|
-
|
|
27158
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.js":
|
|
27159
|
-
/*!*********************************************************************************************************************!*\
|
|
27160
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.js ***!
|
|
27161
|
-
\*********************************************************************************************************************/
|
|
27162
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
27163
|
-
|
|
27164
|
-
"use strict";
|
|
27165
|
-
|
|
27166
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
27167
|
-
exports.ErrorOidcHandler = void 0;
|
|
27168
|
-
const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
|
|
27169
|
-
const SessionInfoManager_1 = __webpack_require__(/*! ../../../sessionInfo/SessionInfoManager */ "./node_modules/@inrupt/solid-client-authn-browser/dist/sessionInfo/SessionInfoManager.js");
|
|
27170
|
-
class ErrorOidcHandler {
|
|
27171
|
-
async canHandle(redirectUrl) {
|
|
27172
|
-
try {
|
|
27173
|
-
return new URL(redirectUrl).searchParams.has("error");
|
|
27174
|
-
}
|
|
27175
|
-
catch (e) {
|
|
27176
|
-
throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);
|
|
27177
|
-
}
|
|
27178
|
-
}
|
|
27179
|
-
async handle(redirectUrl, eventEmitter) {
|
|
27180
|
-
if (eventEmitter !== undefined) {
|
|
27181
|
-
const url = new URL(redirectUrl);
|
|
27182
|
-
const errorUrl = url.searchParams.get("error");
|
|
27183
|
-
const errorDescriptionUrl = url.searchParams.get("error_description");
|
|
27184
|
-
eventEmitter.emit(solid_client_authn_core_1.EVENTS.ERROR, errorUrl, errorDescriptionUrl);
|
|
27185
|
-
}
|
|
27186
|
-
return (0, SessionInfoManager_1.getUnauthenticatedSession)();
|
|
27187
|
-
}
|
|
27188
|
-
}
|
|
27189
|
-
exports.ErrorOidcHandler = ErrorOidcHandler;
|
|
27190
|
-
//# sourceMappingURL=ErrorOidcHandler.js.map
|
|
27191
|
-
|
|
27192
|
-
/***/ }),
|
|
27193
|
-
|
|
27194
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.js":
|
|
27195
|
-
/*!****************************************************************************************************************************!*\
|
|
27196
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.js ***!
|
|
27197
|
-
\****************************************************************************************************************************/
|
|
27198
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
27199
|
-
|
|
27200
|
-
"use strict";
|
|
27201
27095
|
|
|
27202
|
-
|
|
27203
|
-
|
|
27204
|
-
|
|
27205
|
-
|
|
27206
|
-
|
|
27207
|
-
|
|
27208
|
-
|
|
27209
|
-
|
|
27210
|
-
|
|
27211
|
-
|
|
27212
|
-
|
|
27213
|
-
|
|
27214
|
-
|
|
27215
|
-
|
|
27216
|
-
|
|
27096
|
+
//
|
|
27097
|
+
// Copyright Inrupt Inc.
|
|
27098
|
+
//
|
|
27099
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27100
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
27101
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
27102
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
27103
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
27104
|
+
// subject to the following conditions:
|
|
27105
|
+
//
|
|
27106
|
+
// The above copyright notice and this permission notice shall be included in
|
|
27107
|
+
// all copies or substantial portions of the Software.
|
|
27108
|
+
//
|
|
27109
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
27110
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
27111
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
27112
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27113
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27114
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27115
|
+
//
|
|
27116
|
+
/**
|
|
27117
|
+
* @hidden
|
|
27118
|
+
*/
|
|
27119
|
+
class AggregateRedirectHandler extends solidClientAuthnCore.AggregateHandler {
|
|
27120
|
+
constructor(redirectHandlers) {
|
|
27121
|
+
super(redirectHandlers);
|
|
27217
27122
|
}
|
|
27218
27123
|
}
|
|
27219
|
-
exports.FallbackRedirectHandler = FallbackRedirectHandler;
|
|
27220
|
-
//# sourceMappingURL=FallbackRedirectHandler.js.map
|
|
27221
|
-
|
|
27222
|
-
/***/ }),
|
|
27223
|
-
|
|
27224
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js":
|
|
27225
|
-
/*!******************************************************************************************************************************!*\
|
|
27226
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js ***!
|
|
27227
|
-
\******************************************************************************************************************************/
|
|
27228
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
27229
|
-
|
|
27230
|
-
"use strict";
|
|
27231
27124
|
|
|
27232
|
-
|
|
27233
|
-
|
|
27234
|
-
|
|
27235
|
-
|
|
27236
|
-
|
|
27237
|
-
|
|
27238
|
-
|
|
27239
|
-
|
|
27240
|
-
|
|
27241
|
-
|
|
27242
|
-
|
|
27125
|
+
//
|
|
27126
|
+
// Copyright Inrupt Inc.
|
|
27127
|
+
//
|
|
27128
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27129
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
27130
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
27131
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
27132
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
27133
|
+
// subject to the following conditions:
|
|
27134
|
+
//
|
|
27135
|
+
// The above copyright notice and this permission notice shall be included in
|
|
27136
|
+
// all copies or substantial portions of the Software.
|
|
27137
|
+
//
|
|
27138
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
27139
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
27140
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
27141
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27142
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27143
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27144
|
+
//
|
|
27145
|
+
/**
|
|
27146
|
+
* @hidden
|
|
27147
|
+
*/
|
|
27148
|
+
class BrowserStorage {
|
|
27149
|
+
get storage() {
|
|
27150
|
+
return window.localStorage;
|
|
27243
27151
|
}
|
|
27244
|
-
async
|
|
27245
|
-
|
|
27246
|
-
|
|
27247
|
-
|
|
27248
|
-
|
|
27249
|
-
|
|
27250
|
-
|
|
27251
|
-
|
|
27252
|
-
|
|
27253
|
-
|
|
27254
|
-
|
|
27255
|
-
|
|
27256
|
-
|
|
27257
|
-
|
|
27258
|
-
|
|
27259
|
-
|
|
27260
|
-
|
|
27261
|
-
|
|
27152
|
+
async get(key) {
|
|
27153
|
+
return this.storage.getItem(key) || undefined;
|
|
27154
|
+
}
|
|
27155
|
+
async set(key, value) {
|
|
27156
|
+
this.storage.setItem(key, value);
|
|
27157
|
+
}
|
|
27158
|
+
async delete(key) {
|
|
27159
|
+
this.storage.removeItem(key);
|
|
27160
|
+
}
|
|
27161
|
+
}
|
|
27162
|
+
|
|
27163
|
+
//
|
|
27164
|
+
// Copyright Inrupt Inc.
|
|
27165
|
+
//
|
|
27166
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27167
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
27168
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
27169
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
27170
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
27171
|
+
// subject to the following conditions:
|
|
27172
|
+
//
|
|
27173
|
+
// The above copyright notice and this permission notice shall be included in
|
|
27174
|
+
// all copies or substantial portions of the Software.
|
|
27175
|
+
//
|
|
27176
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
27177
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
27178
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
27179
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27180
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27181
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27182
|
+
//
|
|
27183
|
+
/**
|
|
27184
|
+
* @hidden
|
|
27185
|
+
*/
|
|
27186
|
+
class Redirector {
|
|
27187
|
+
redirect(redirectUrl, options) {
|
|
27188
|
+
if (options && options.handleRedirect) {
|
|
27189
|
+
options.handleRedirect(redirectUrl);
|
|
27190
|
+
}
|
|
27191
|
+
else if (options && options.redirectByReplacingState) {
|
|
27192
|
+
window.history.replaceState({}, "", redirectUrl);
|
|
27193
|
+
}
|
|
27194
|
+
else {
|
|
27195
|
+
window.location.href = redirectUrl;
|
|
27196
|
+
}
|
|
27197
|
+
}
|
|
27198
|
+
}
|
|
27199
|
+
|
|
27200
|
+
//
|
|
27201
|
+
// Copyright Inrupt Inc.
|
|
27202
|
+
//
|
|
27203
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27204
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
27205
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
27206
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
27207
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
27208
|
+
// subject to the following conditions:
|
|
27209
|
+
//
|
|
27210
|
+
// The above copyright notice and this permission notice shall be included in
|
|
27211
|
+
// all copies or substantial portions of the Software.
|
|
27212
|
+
//
|
|
27213
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
27214
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
27215
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
27216
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27217
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27218
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27219
|
+
//
|
|
27220
|
+
/**
|
|
27221
|
+
* @hidden
|
|
27222
|
+
*/
|
|
27223
|
+
class ClientRegistrar {
|
|
27224
|
+
constructor(storageUtility) {
|
|
27225
|
+
this.storageUtility = storageUtility;
|
|
27226
|
+
this.storageUtility = storageUtility;
|
|
27227
|
+
}
|
|
27228
|
+
async getClient(options, issuerConfig) {
|
|
27229
|
+
// If client secret and/or client id are stored in storage, use those.
|
|
27230
|
+
const [storedClientId, storedClientSecret,
|
|
27231
|
+
// storedClientName,
|
|
27232
|
+
] = await Promise.all([
|
|
27233
|
+
this.storageUtility.getForUser(options.sessionId, "clientId", {
|
|
27234
|
+
secure: false,
|
|
27235
|
+
}),
|
|
27236
|
+
this.storageUtility.getForUser(options.sessionId, "clientSecret", {
|
|
27237
|
+
secure: false,
|
|
27238
|
+
}),
|
|
27239
|
+
// this.storageUtility.getForUser(options.sessionId, "clientName", {
|
|
27240
|
+
// // FIXME: figure out how to persist secure storage at reload
|
|
27241
|
+
// secure: false,
|
|
27242
|
+
// }),
|
|
27243
|
+
]);
|
|
27244
|
+
if (storedClientId) {
|
|
27245
|
+
return {
|
|
27246
|
+
clientId: storedClientId,
|
|
27247
|
+
clientSecret: storedClientSecret,
|
|
27248
|
+
clientType: "dynamic",
|
|
27249
|
+
};
|
|
27250
|
+
}
|
|
27262
27251
|
try {
|
|
27263
|
-
const
|
|
27264
|
-
|
|
27265
|
-
|
|
27266
|
-
|
|
27267
|
-
|
|
27268
|
-
|
|
27269
|
-
|
|
27270
|
-
|
|
27271
|
-
|
|
27272
|
-
|
|
27273
|
-
|
|
27274
|
-
|
|
27275
|
-
|
|
27276
|
-
|
|
27252
|
+
const registeredClient = await oidcClientExt.registerClient(options, issuerConfig);
|
|
27253
|
+
// Save info
|
|
27254
|
+
const infoToSave = {
|
|
27255
|
+
clientId: registeredClient.clientId,
|
|
27256
|
+
};
|
|
27257
|
+
if (registeredClient.clientSecret) {
|
|
27258
|
+
infoToSave.clientSecret = registeredClient.clientSecret;
|
|
27259
|
+
}
|
|
27260
|
+
if (registeredClient.idTokenSignedResponseAlg) {
|
|
27261
|
+
infoToSave.idTokenSignedResponseAlg =
|
|
27262
|
+
registeredClient.idTokenSignedResponseAlg;
|
|
27263
|
+
}
|
|
27264
|
+
await this.storageUtility.setForUser(options.sessionId, infoToSave, {
|
|
27265
|
+
// FIXME: figure out how to persist secure storage at reload
|
|
27266
|
+
// Otherwise, the client info cannot be retrieved from storage, and
|
|
27267
|
+
// the lib tries to re-register the client on each fetch
|
|
27268
|
+
secure: false,
|
|
27277
27269
|
});
|
|
27270
|
+
return registeredClient;
|
|
27278
27271
|
}
|
|
27279
|
-
catch (
|
|
27280
|
-
|
|
27272
|
+
catch (error) {
|
|
27273
|
+
throw new Error(`Client registration failed: [${error}]`);
|
|
27281
27274
|
}
|
|
27282
|
-
return undefined;
|
|
27283
27275
|
}
|
|
27284
27276
|
}
|
|
27285
|
-
exports["default"] = AuthorizationCodeWithPkceOidcHandler;
|
|
27286
|
-
//# sourceMappingURL=AuthorizationCodeWithPkceOidcHandler.js.map
|
|
27287
|
-
|
|
27288
|
-
/***/ }),
|
|
27289
|
-
|
|
27290
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/refresh/TokenRefresher.js":
|
|
27291
|
-
/*!***************************************************************************************************!*\
|
|
27292
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/refresh/TokenRefresher.js ***!
|
|
27293
|
-
\***************************************************************************************************/
|
|
27294
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
27295
27277
|
|
|
27296
|
-
|
|
27278
|
+
//
|
|
27279
|
+
// Copyright Inrupt Inc.
|
|
27280
|
+
//
|
|
27281
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27282
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
27283
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
27284
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
27285
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
27286
|
+
// subject to the following conditions:
|
|
27287
|
+
//
|
|
27288
|
+
// The above copyright notice and this permission notice shall be included in
|
|
27289
|
+
// all copies or substantial portions of the Software.
|
|
27290
|
+
//
|
|
27291
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
27292
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
27293
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
27294
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27295
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27296
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27297
|
+
//
|
|
27298
|
+
/**
|
|
27299
|
+
* This class handles redirect IRIs without any query params, and returns an unauthenticated
|
|
27300
|
+
* session. It serves as a fallback so that consuming libraries don't have to test
|
|
27301
|
+
* for the query params themselves, and can always try to use them as a redirect IRI.
|
|
27302
|
+
* @hidden
|
|
27303
|
+
*/
|
|
27304
|
+
class ErrorOidcHandler {
|
|
27305
|
+
async canHandle(redirectUrl) {
|
|
27306
|
+
try {
|
|
27307
|
+
// eslint-disable-next-line no-new
|
|
27308
|
+
return new URL(redirectUrl).searchParams.has("error");
|
|
27309
|
+
}
|
|
27310
|
+
catch (e) {
|
|
27311
|
+
throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);
|
|
27312
|
+
}
|
|
27313
|
+
}
|
|
27314
|
+
async handle(redirectUrl, eventEmitter) {
|
|
27315
|
+
if (eventEmitter !== undefined) {
|
|
27316
|
+
const url = new URL(redirectUrl);
|
|
27317
|
+
const errorUrl = url.searchParams.get("error");
|
|
27318
|
+
const errorDescriptionUrl = url.searchParams.get("error_description");
|
|
27319
|
+
eventEmitter.emit(solidClientAuthnCore.EVENTS.ERROR, errorUrl, errorDescriptionUrl);
|
|
27320
|
+
}
|
|
27321
|
+
return solidClientAuthnCore.getUnauthenticatedSession();
|
|
27322
|
+
}
|
|
27323
|
+
}
|
|
27297
27324
|
|
|
27298
|
-
|
|
27299
|
-
|
|
27300
|
-
|
|
27325
|
+
//
|
|
27326
|
+
// Copyright Inrupt Inc.
|
|
27327
|
+
//
|
|
27328
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27329
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
27330
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
27331
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
27332
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
27333
|
+
// subject to the following conditions:
|
|
27334
|
+
//
|
|
27335
|
+
// The above copyright notice and this permission notice shall be included in
|
|
27336
|
+
// all copies or substantial portions of the Software.
|
|
27337
|
+
//
|
|
27338
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
27339
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
27340
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
27341
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27342
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27343
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27344
|
+
//
|
|
27345
|
+
// Some identifiers are not in camelcase on purpose, as they are named using the
|
|
27346
|
+
// official names from the OIDC/OAuth2 specifications.
|
|
27347
|
+
/* eslint-disable camelcase */
|
|
27348
|
+
/**
|
|
27349
|
+
* @hidden
|
|
27350
|
+
*/
|
|
27301
27351
|
class TokenRefresher {
|
|
27302
27352
|
constructor(storageUtility, issuerConfigFetcher, clientRegistrar) {
|
|
27303
27353
|
this.storageUtility = storageUtility;
|
|
27304
27354
|
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
27305
27355
|
this.clientRegistrar = clientRegistrar;
|
|
27356
|
+
this.storageUtility = storageUtility;
|
|
27357
|
+
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
27358
|
+
this.clientRegistrar = clientRegistrar;
|
|
27306
27359
|
}
|
|
27307
27360
|
async refresh(sessionId, refreshToken, dpopKey, eventEmitter) {
|
|
27308
|
-
const oidcContext = await
|
|
27361
|
+
const oidcContext = await solidClientAuthnCore.loadOidcContextFromStorage(sessionId, this.storageUtility, this.issuerConfigFetcher);
|
|
27362
|
+
// This should also retrieve the client from storage
|
|
27309
27363
|
const clientInfo = await this.clientRegistrar.getClient({ sessionId }, oidcContext.issuerConfig);
|
|
27310
27364
|
if (refreshToken === undefined) {
|
|
27365
|
+
// TODO: in a next PR, look up storage for a refresh token
|
|
27311
27366
|
throw new Error(`Session [${sessionId}] has no refresh token to allow it to refresh its access token.`);
|
|
27312
27367
|
}
|
|
27313
27368
|
if (oidcContext.dpop && dpopKey === undefined) {
|
|
27314
27369
|
throw new Error(`For session [${sessionId}], the key bound to the DPoP access token must be provided to refresh said access token.`);
|
|
27315
27370
|
}
|
|
27316
|
-
const tokenSet = await
|
|
27371
|
+
const tokenSet = await oidcClientExt.refresh(refreshToken, oidcContext.issuerConfig, clientInfo, dpopKey);
|
|
27317
27372
|
if (tokenSet.refreshToken !== undefined) {
|
|
27318
|
-
eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(
|
|
27373
|
+
eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(solidClientAuthnCore.EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken);
|
|
27319
27374
|
await this.storageUtility.setForUser(sessionId, {
|
|
27320
27375
|
refreshToken: tokenSet.refreshToken,
|
|
27321
27376
|
});
|
|
@@ -27323,187 +27378,546 @@ class TokenRefresher {
|
|
|
27323
27378
|
return tokenSet;
|
|
27324
27379
|
}
|
|
27325
27380
|
}
|
|
27326
|
-
exports["default"] = TokenRefresher;
|
|
27327
|
-
//# sourceMappingURL=TokenRefresher.js.map
|
|
27328
|
-
|
|
27329
|
-
/***/ }),
|
|
27330
|
-
|
|
27331
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/logout/GeneralLogoutHandler.js":
|
|
27332
|
-
/*!*********************************************************************************************!*\
|
|
27333
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/logout/GeneralLogoutHandler.js ***!
|
|
27334
|
-
\*********************************************************************************************/
|
|
27335
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
27336
|
-
|
|
27337
|
-
"use strict";
|
|
27338
|
-
|
|
27339
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
27340
|
-
class GeneralLogoutHandler {
|
|
27341
|
-
constructor(sessionInfoManager) {
|
|
27342
|
-
this.sessionInfoManager = sessionInfoManager;
|
|
27343
|
-
}
|
|
27344
|
-
async canHandle() {
|
|
27345
|
-
return true;
|
|
27346
|
-
}
|
|
27347
|
-
async handle(userId) {
|
|
27348
|
-
await this.sessionInfoManager.clear(userId);
|
|
27349
|
-
}
|
|
27350
|
-
}
|
|
27351
|
-
exports["default"] = GeneralLogoutHandler;
|
|
27352
|
-
//# sourceMappingURL=GeneralLogoutHandler.js.map
|
|
27353
|
-
|
|
27354
|
-
/***/ }),
|
|
27355
|
-
|
|
27356
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/sessionInfo/SessionInfoManager.js":
|
|
27357
|
-
/*!************************************************************************************************!*\
|
|
27358
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/sessionInfo/SessionInfoManager.js ***!
|
|
27359
|
-
\************************************************************************************************/
|
|
27360
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
27361
27381
|
|
|
27362
|
-
|
|
27363
|
-
|
|
27364
|
-
|
|
27365
|
-
|
|
27366
|
-
|
|
27367
|
-
|
|
27368
|
-
|
|
27369
|
-
|
|
27370
|
-
|
|
27371
|
-
|
|
27372
|
-
|
|
27373
|
-
|
|
27374
|
-
|
|
27375
|
-
|
|
27376
|
-
|
|
27377
|
-
|
|
27378
|
-
|
|
27379
|
-
|
|
27380
|
-
|
|
27381
|
-
|
|
27382
|
-
|
|
27382
|
+
//
|
|
27383
|
+
// Copyright Inrupt Inc.
|
|
27384
|
+
//
|
|
27385
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27386
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
27387
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
27388
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
27389
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
27390
|
+
// subject to the following conditions:
|
|
27391
|
+
//
|
|
27392
|
+
// The above copyright notice and this permission notice shall be included in
|
|
27393
|
+
// all copies or substantial portions of the Software.
|
|
27394
|
+
//
|
|
27395
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
27396
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
27397
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
27398
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27399
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27400
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27401
|
+
//
|
|
27402
|
+
/**
|
|
27403
|
+
*
|
|
27404
|
+
* @param dependencies
|
|
27405
|
+
* @deprecated This function will be removed from the external API in an upcoming release.
|
|
27406
|
+
*/
|
|
27407
|
+
function getClientAuthenticationWithDependencies(dependencies) {
|
|
27408
|
+
const inMemoryStorage = new solidClientAuthnCore.InMemoryStorage();
|
|
27409
|
+
const secureStorage = dependencies.secureStorage || inMemoryStorage;
|
|
27410
|
+
const insecureStorage = dependencies.insecureStorage || new BrowserStorage();
|
|
27411
|
+
const storageUtility = new StorageUtilityBrowser(secureStorage, insecureStorage);
|
|
27412
|
+
const issuerConfigFetcher = new IssuerConfigFetcher(storageUtility);
|
|
27413
|
+
const clientRegistrar = new ClientRegistrar(storageUtility);
|
|
27414
|
+
const sessionInfoManager = new SessionInfoManager(storageUtility);
|
|
27415
|
+
const tokenRefresher = new TokenRefresher(storageUtility, issuerConfigFetcher, clientRegistrar);
|
|
27416
|
+
const redirector = new Redirector();
|
|
27417
|
+
// make new handler for redirect and login
|
|
27418
|
+
const loginHandler = new OidcLoginHandler(storageUtility, new AuthorizationCodeWithPkceOidcHandler(storageUtility, redirector), issuerConfigFetcher, clientRegistrar);
|
|
27419
|
+
const redirectHandler = new AggregateRedirectHandler([
|
|
27420
|
+
new ErrorOidcHandler(),
|
|
27421
|
+
new AuthCodeRedirectHandler(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokenRefresher),
|
|
27422
|
+
// This catch-all class will always be able to handle the
|
|
27423
|
+
// redirect IRI, so it must be registered last.
|
|
27424
|
+
new FallbackRedirectHandler(),
|
|
27383
27425
|
]);
|
|
27384
|
-
|
|
27426
|
+
return new ClientAuthentication(loginHandler, redirectHandler, new solidClientAuthnCore.IWaterfallLogoutHandler(sessionInfoManager, redirector), sessionInfoManager, issuerConfigFetcher);
|
|
27385
27427
|
}
|
|
27386
|
-
|
|
27387
|
-
|
|
27388
|
-
|
|
27389
|
-
|
|
27390
|
-
|
|
27391
|
-
|
|
27392
|
-
|
|
27428
|
+
|
|
27429
|
+
//
|
|
27430
|
+
// Copyright Inrupt Inc.
|
|
27431
|
+
//
|
|
27432
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27433
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
27434
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
27435
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
27436
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
27437
|
+
// subject to the following conditions:
|
|
27438
|
+
//
|
|
27439
|
+
// The above copyright notice and this permission notice shall be included in
|
|
27440
|
+
// all copies or substantial portions of the Software.
|
|
27441
|
+
//
|
|
27442
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
27443
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
27444
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
27445
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27446
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27447
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27448
|
+
//
|
|
27449
|
+
const KEY_CURRENT_SESSION = `${solidClientAuthnCore.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentSession`;
|
|
27450
|
+
const KEY_CURRENT_URL = `${solidClientAuthnCore.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentUrl`;
|
|
27451
|
+
|
|
27452
|
+
//
|
|
27453
|
+
// Copyright Inrupt Inc.
|
|
27454
|
+
//
|
|
27455
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27456
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
27457
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
27458
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
27459
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
27460
|
+
// subject to the following conditions:
|
|
27461
|
+
//
|
|
27462
|
+
// The above copyright notice and this permission notice shall be included in
|
|
27463
|
+
// all copies or substantial portions of the Software.
|
|
27464
|
+
//
|
|
27465
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
27466
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
27467
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
27468
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27469
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27470
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27471
|
+
//
|
|
27472
|
+
async function silentlyAuthenticate(sessionId, clientAuthn, session) {
|
|
27473
|
+
var _a;
|
|
27474
|
+
const storedSessionInfo = await clientAuthn.validateCurrentSession(sessionId);
|
|
27475
|
+
if (storedSessionInfo !== null) {
|
|
27476
|
+
// It can be really useful to save the user's current browser location,
|
|
27477
|
+
// so that we can restore it after completing the silent authentication
|
|
27478
|
+
// on incoming redirect. This way, the user is eventually redirected back
|
|
27479
|
+
// to the page they were on and not to the app's redirect page.
|
|
27480
|
+
window.localStorage.setItem(KEY_CURRENT_URL, window.location.href);
|
|
27481
|
+
await clientAuthn.login({
|
|
27482
|
+
sessionId,
|
|
27483
|
+
prompt: "none",
|
|
27484
|
+
oidcIssuer: storedSessionInfo.issuer,
|
|
27485
|
+
redirectUrl: storedSessionInfo.redirectUrl,
|
|
27486
|
+
clientId: storedSessionInfo.clientAppId,
|
|
27487
|
+
clientSecret: storedSessionInfo.clientAppSecret,
|
|
27488
|
+
tokenType: (_a = storedSessionInfo.tokenType) !== null && _a !== void 0 ? _a : "DPoP",
|
|
27489
|
+
}, session.events);
|
|
27490
|
+
return true;
|
|
27393
27491
|
}
|
|
27394
|
-
|
|
27395
|
-
|
|
27396
|
-
|
|
27397
|
-
|
|
27398
|
-
|
|
27399
|
-
|
|
27400
|
-
|
|
27401
|
-
|
|
27402
|
-
|
|
27403
|
-
|
|
27404
|
-
|
|
27405
|
-
|
|
27406
|
-
|
|
27407
|
-
|
|
27408
|
-
|
|
27409
|
-
|
|
27410
|
-
|
|
27411
|
-
|
|
27412
|
-
|
|
27413
|
-
|
|
27414
|
-
|
|
27415
|
-
|
|
27416
|
-
|
|
27417
|
-
|
|
27418
|
-
|
|
27419
|
-
|
|
27420
|
-
|
|
27421
|
-
|
|
27492
|
+
return false;
|
|
27493
|
+
}
|
|
27494
|
+
function isLoggedIn(sessionInfo) {
|
|
27495
|
+
return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
|
|
27496
|
+
}
|
|
27497
|
+
/**
|
|
27498
|
+
* A {@link Session} object represents a user's session on an application. The session holds state, as it stores information enabling acces to private resources after login for instance.
|
|
27499
|
+
*/
|
|
27500
|
+
class Session extends EventEmitter {
|
|
27501
|
+
/**
|
|
27502
|
+
* Session object constructor. Typically called as follows:
|
|
27503
|
+
*
|
|
27504
|
+
* ```typescript
|
|
27505
|
+
* const session = new Session();
|
|
27506
|
+
* ```
|
|
27507
|
+
*
|
|
27508
|
+
* See also [getDefaultSession](https://docs.inrupt.com/developer-tools/api/javascript/solid-client-authn-browser/functions.html#getdefaultsession).
|
|
27509
|
+
*
|
|
27510
|
+
* @param sessionOptions The options enabling the correct instantiation of
|
|
27511
|
+
* the session. Either both storages or clientAuthentication are required. For
|
|
27512
|
+
* more information, see {@link ISessionOptions}.
|
|
27513
|
+
* @param sessionId A string uniquely identifying the session.
|
|
27514
|
+
*
|
|
27515
|
+
*/
|
|
27516
|
+
constructor(sessionOptions = {}, sessionId = undefined) {
|
|
27517
|
+
super();
|
|
27518
|
+
this.tokenRequestInProgress = false;
|
|
27519
|
+
/**
|
|
27520
|
+
* Triggers the login process. Note that this method will redirect the user away from your app.
|
|
27521
|
+
*
|
|
27522
|
+
* @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider.
|
|
27523
|
+
* @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by {@linkcode handleIncomingRedirect}.
|
|
27524
|
+
*/
|
|
27525
|
+
// Define these functions as properties so that they don't get accidentally re-bound.
|
|
27526
|
+
// Isn't Javascript fun?
|
|
27527
|
+
this.login = async (options) => {
|
|
27528
|
+
var _a;
|
|
27529
|
+
await this.clientAuthentication.login({
|
|
27530
|
+
sessionId: this.info.sessionId,
|
|
27531
|
+
...options,
|
|
27532
|
+
// Defaults the token type to DPoP
|
|
27533
|
+
tokenType: (_a = options.tokenType) !== null && _a !== void 0 ? _a : "DPoP",
|
|
27534
|
+
}, this.events);
|
|
27535
|
+
// `login` redirects the user away from the app,
|
|
27536
|
+
// so unless it throws an error, there is no code that should run afterwards
|
|
27537
|
+
// (since there is no "after" in the lifetime of the script).
|
|
27538
|
+
// Hence, this Promise never resolves:
|
|
27539
|
+
return new Promise(() => { });
|
|
27540
|
+
};
|
|
27541
|
+
/**
|
|
27542
|
+
* Fetches data using available login information. If the user is not logged in, this will behave as a regular `fetch`. The signature of this method is identical to the [canonical `fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
|
|
27543
|
+
*
|
|
27544
|
+
* @param url The URL from which data should be fetched.
|
|
27545
|
+
* @param init Optional parameters customizing the request, by specifying an HTTP method, headers, a body, etc. Follows the [WHATWG Fetch Standard](https://fetch.spec.whatwg.org/).
|
|
27546
|
+
*/
|
|
27547
|
+
this.fetch = (url, init) => this.clientAuthentication.fetch(url, init);
|
|
27548
|
+
/**
|
|
27549
|
+
* An internal logout function, to control whether or not the logout signal
|
|
27550
|
+
* should be sent, i.e. if the logout was user-initiated or is the result of
|
|
27551
|
+
* an external event.
|
|
27552
|
+
*
|
|
27553
|
+
* @hidden
|
|
27554
|
+
*/
|
|
27555
|
+
this.internalLogout = async (emitSignal, options) => {
|
|
27556
|
+
// Clearing this value means that silent refresh will no longer be attempted.
|
|
27557
|
+
// In particular, in the case of a silent authentication error it prevents
|
|
27558
|
+
// from getting stuck in an authentication retries loop.
|
|
27559
|
+
window.localStorage.removeItem(KEY_CURRENT_SESSION);
|
|
27560
|
+
await this.clientAuthentication.logout(this.info.sessionId, options);
|
|
27561
|
+
this.info.isLoggedIn = false;
|
|
27562
|
+
if (emitSignal) {
|
|
27563
|
+
this.events.emit(solidClientAuthnCore.EVENTS.LOGOUT);
|
|
27564
|
+
}
|
|
27565
|
+
};
|
|
27566
|
+
/**
|
|
27567
|
+
* Logs the user out of the application.
|
|
27568
|
+
*
|
|
27569
|
+
* There are 2 types of logout supported by this library,
|
|
27570
|
+
* `app` logout and `idp` logout.
|
|
27571
|
+
*
|
|
27572
|
+
* App logout will log the user out within the application
|
|
27573
|
+
* by clearing any session data from the browser. It does
|
|
27574
|
+
* not log the user out of their Solid identity provider,
|
|
27575
|
+
* and should not redirect the user away.
|
|
27576
|
+
* App logout can be performed as follows:
|
|
27577
|
+
* ```typescript
|
|
27578
|
+
* await session.logout({ logoutType: 'app' });
|
|
27579
|
+
* ```
|
|
27580
|
+
*
|
|
27581
|
+
* IDP logout will log the user out of their Solid identity provider,
|
|
27582
|
+
* and will redirect the user away from the application to do so. In order
|
|
27583
|
+
* for users to be redirected back to `postLogoutUrl` you MUST include the
|
|
27584
|
+
* `postLogoutUrl` value in the `post_logout_redirect_uris` field in the
|
|
27585
|
+
* [Client ID Document](https://docs.inrupt.com/ess/latest/security/authentication/#client-identifier-client-id).
|
|
27586
|
+
* IDP logout can be performed as follows:
|
|
27587
|
+
* ```typescript
|
|
27588
|
+
* await session.logout({
|
|
27589
|
+
* logoutType: 'idp',
|
|
27590
|
+
* // An optional URL to redirect to after logout has completed;
|
|
27591
|
+
* // this MUST match a logout URL listed in the Client ID Document
|
|
27592
|
+
* // of the application that is logged in.
|
|
27593
|
+
* // If the application is logged in with a Client ID that is not
|
|
27594
|
+
* // a URI dereferencing to a Client ID Document then users will
|
|
27595
|
+
* // not be redirected back to the `postLogoutUrl` after logout.
|
|
27596
|
+
* postLogoutUrl: 'https://example.com/logout',
|
|
27597
|
+
* // An optional value to be included in the query parameters
|
|
27598
|
+
* // when the IDP provider redirects the user to the postLogoutRedirectUrl.
|
|
27599
|
+
* state: "my-state"
|
|
27600
|
+
* });
|
|
27601
|
+
* ```
|
|
27602
|
+
*/
|
|
27603
|
+
this.logout = async (options) => this.internalLogout(true, options);
|
|
27604
|
+
/**
|
|
27605
|
+
* Completes the login process by processing the information provided by the
|
|
27606
|
+
* Solid identity provider through redirect.
|
|
27607
|
+
*
|
|
27608
|
+
* @param options See {@see IHandleIncomingRedirectOptions}.
|
|
27609
|
+
*/
|
|
27610
|
+
this.handleIncomingRedirect = async (inputOptions = {}) => {
|
|
27611
|
+
var _a;
|
|
27612
|
+
if (this.info.isLoggedIn) {
|
|
27613
|
+
return this.info;
|
|
27614
|
+
}
|
|
27615
|
+
if (this.tokenRequestInProgress) {
|
|
27616
|
+
return undefined;
|
|
27617
|
+
}
|
|
27618
|
+
const options = typeof inputOptions === "string" ? { url: inputOptions } : inputOptions;
|
|
27619
|
+
const url = (_a = options.url) !== null && _a !== void 0 ? _a : window.location.href;
|
|
27620
|
+
this.tokenRequestInProgress = true;
|
|
27621
|
+
const sessionInfo = await this.clientAuthentication.handleIncomingRedirect(url, this.events);
|
|
27622
|
+
if (isLoggedIn(sessionInfo)) {
|
|
27623
|
+
this.setSessionInfo(sessionInfo);
|
|
27624
|
+
const currentUrl = window.localStorage.getItem(KEY_CURRENT_URL);
|
|
27625
|
+
if (currentUrl === null) {
|
|
27626
|
+
// The login event can only be triggered **after** the user has been
|
|
27627
|
+
// redirected from the IdP with access and ID tokens.
|
|
27628
|
+
this.events.emit(solidClientAuthnCore.EVENTS.LOGIN);
|
|
27629
|
+
}
|
|
27630
|
+
else {
|
|
27631
|
+
// If an URL is stored in local storage, we are being logged in after a
|
|
27632
|
+
// silent authentication, so remove our currently stored URL location
|
|
27633
|
+
// to clean up our state now that we are completing the re-login process.
|
|
27634
|
+
window.localStorage.removeItem(KEY_CURRENT_URL);
|
|
27635
|
+
this.events.emit(solidClientAuthnCore.EVENTS.SESSION_RESTORED, currentUrl);
|
|
27636
|
+
}
|
|
27637
|
+
}
|
|
27638
|
+
else if (options.restorePreviousSession === true) {
|
|
27639
|
+
// Silent authentication happens after a refresh, which means there are no
|
|
27640
|
+
// OAuth params in the current location IRI. It can only succeed if a session
|
|
27641
|
+
// was previously logged in, in which case its ID will be present with a known
|
|
27642
|
+
// identifier in local storage.
|
|
27643
|
+
// Check if we have a locally stored session ID...
|
|
27644
|
+
const storedSessionId = window.localStorage.getItem(KEY_CURRENT_SESSION);
|
|
27645
|
+
// ...if not, then there is no ID token, and so silent authentication cannot happen, but
|
|
27646
|
+
// if we do have a stored session ID, attempt to re-authenticate now silently.
|
|
27647
|
+
if (storedSessionId !== null) {
|
|
27648
|
+
const attemptedSilentAuthentication = await silentlyAuthenticate(storedSessionId, this.clientAuthentication, this);
|
|
27649
|
+
// At this point, we know that the main window will imminently be redirected.
|
|
27650
|
+
// However, this redirect is asynchronous and there is no way to halt execution
|
|
27651
|
+
// until it happens precisely. That's why the current Promise simply does not
|
|
27652
|
+
// resolve.
|
|
27653
|
+
if (attemptedSilentAuthentication) {
|
|
27654
|
+
return new Promise(() => { });
|
|
27655
|
+
}
|
|
27656
|
+
}
|
|
27657
|
+
}
|
|
27658
|
+
this.tokenRequestInProgress = false;
|
|
27659
|
+
return sessionInfo;
|
|
27660
|
+
};
|
|
27661
|
+
// Until Session no longer implements EventEmitter, this.events is just a proxy
|
|
27662
|
+
// to this (with some interface filtering). When we make the breaking change,
|
|
27663
|
+
// this.events will be a regular EventEmitter (implementing ISessionEventEmitter):
|
|
27664
|
+
// this.events = new EventEmitter();
|
|
27665
|
+
this.events = new Proxy(this, solidClientAuthnCore.buildProxyHandler(Session.prototype, "events only implements ISessionEventListener"));
|
|
27666
|
+
if (sessionOptions.clientAuthentication) {
|
|
27667
|
+
this.clientAuthentication = sessionOptions.clientAuthentication;
|
|
27422
27668
|
}
|
|
27423
|
-
if (
|
|
27424
|
-
|
|
27425
|
-
|
|
27426
|
-
|
|
27427
|
-
|
|
27669
|
+
else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) {
|
|
27670
|
+
this.clientAuthentication = getClientAuthenticationWithDependencies({
|
|
27671
|
+
secureStorage: sessionOptions.secureStorage,
|
|
27672
|
+
insecureStorage: sessionOptions.insecureStorage,
|
|
27673
|
+
});
|
|
27428
27674
|
}
|
|
27429
|
-
|
|
27430
|
-
|
|
27431
|
-
|
|
27432
|
-
|
|
27433
|
-
|
|
27434
|
-
|
|
27435
|
-
|
|
27436
|
-
|
|
27437
|
-
|
|
27438
|
-
|
|
27439
|
-
|
|
27675
|
+
else {
|
|
27676
|
+
this.clientAuthentication = getClientAuthenticationWithDependencies({});
|
|
27677
|
+
}
|
|
27678
|
+
if (sessionOptions.sessionInfo) {
|
|
27679
|
+
this.info = {
|
|
27680
|
+
sessionId: sessionOptions.sessionInfo.sessionId,
|
|
27681
|
+
isLoggedIn: false,
|
|
27682
|
+
webId: sessionOptions.sessionInfo.webId,
|
|
27683
|
+
};
|
|
27684
|
+
}
|
|
27685
|
+
else {
|
|
27686
|
+
this.info = {
|
|
27687
|
+
sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : uuid.v4(),
|
|
27688
|
+
isLoggedIn: false,
|
|
27689
|
+
};
|
|
27690
|
+
}
|
|
27691
|
+
// When a session is logged in, we want to track its ID in local storage to
|
|
27692
|
+
// enable silent refresh. The current session ID specifically stored in 'localStorage'
|
|
27693
|
+
// (as opposed to using our storage abstraction layer) because it is only
|
|
27694
|
+
// used in a browser-specific mechanism.
|
|
27695
|
+
this.events.on(solidClientAuthnCore.EVENTS.LOGIN, () => window.localStorage.setItem(KEY_CURRENT_SESSION, this.info.sessionId));
|
|
27696
|
+
this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
|
|
27697
|
+
this.events.on(solidClientAuthnCore.EVENTS.ERROR, () => this.internalLogout(false));
|
|
27440
27698
|
}
|
|
27441
|
-
|
|
27442
|
-
|
|
27699
|
+
/**
|
|
27700
|
+
* Register a callback function to be called when a user completes login.
|
|
27701
|
+
*
|
|
27702
|
+
* The callback is called when {@link handleIncomingRedirect} completes successfully.
|
|
27703
|
+
*
|
|
27704
|
+
* @param callback The function called when a user completes login.
|
|
27705
|
+
* @deprecated Prefer session.events.on(EVENTS.LOGIN, callback)
|
|
27706
|
+
*/
|
|
27707
|
+
onLogin(callback) {
|
|
27708
|
+
this.events.on(solidClientAuthnCore.EVENTS.LOGIN, callback);
|
|
27443
27709
|
}
|
|
27444
|
-
|
|
27445
|
-
|
|
27710
|
+
/**
|
|
27711
|
+
* Register a callback function to be called when a user logs out:
|
|
27712
|
+
*
|
|
27713
|
+
* @param callback The function called when a user completes logout.
|
|
27714
|
+
* @deprecated Prefer session.events.on(EVENTS.LOGOUT, callback)
|
|
27715
|
+
*/
|
|
27716
|
+
onLogout(callback) {
|
|
27717
|
+
this.events.on(solidClientAuthnCore.EVENTS.LOGOUT, callback);
|
|
27446
27718
|
}
|
|
27447
|
-
|
|
27448
|
-
|
|
27719
|
+
/**
|
|
27720
|
+
* Register a callback function to be called when a user logs out:
|
|
27721
|
+
*
|
|
27722
|
+
* @param callback The function called when an error occurs.
|
|
27723
|
+
* @since 1.11.0
|
|
27724
|
+
* @deprecated Prefer session.events.on(EVENTS.ERROR, callback)
|
|
27725
|
+
*/
|
|
27726
|
+
onError(callback) {
|
|
27727
|
+
this.events.on(solidClientAuthnCore.EVENTS.ERROR, callback);
|
|
27449
27728
|
}
|
|
27450
|
-
|
|
27451
|
-
|
|
27729
|
+
/**
|
|
27730
|
+
* Register a callback function to be called when a session is restored.
|
|
27731
|
+
*
|
|
27732
|
+
* Note: the callback will be called with the saved value of the 'current URL'
|
|
27733
|
+
* at the time the session was restored.
|
|
27734
|
+
*
|
|
27735
|
+
* @param callback The function called when a user's already logged-in session is restored, e.g., after a silent authentication is completed after a page refresh.
|
|
27736
|
+
* @deprecated Prefer session.events.on(EVENTS.SESSION_RESTORED, callback)
|
|
27737
|
+
*/
|
|
27738
|
+
onSessionRestore(callback) {
|
|
27739
|
+
this.events.on(solidClientAuthnCore.EVENTS.SESSION_RESTORED, callback);
|
|
27452
27740
|
}
|
|
27453
|
-
|
|
27454
|
-
|
|
27741
|
+
/**
|
|
27742
|
+
* Register a callback that runs when the session expires and can no longer
|
|
27743
|
+
* make authenticated requests, but following a user logout.
|
|
27744
|
+
* @param callback The function that runs on session expiration.
|
|
27745
|
+
* @since 1.11.0
|
|
27746
|
+
* @deprecated Prefer session.events.on(EVENTS.SESSION_EXPIRED, callback)
|
|
27747
|
+
*/
|
|
27748
|
+
onSessionExpiration(callback) {
|
|
27749
|
+
this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXPIRED, callback);
|
|
27750
|
+
}
|
|
27751
|
+
setSessionInfo(sessionInfo) {
|
|
27752
|
+
this.info.isLoggedIn = sessionInfo.isLoggedIn;
|
|
27753
|
+
this.info.webId = sessionInfo.webId;
|
|
27754
|
+
this.info.sessionId = sessionInfo.sessionId;
|
|
27755
|
+
this.info.expirationDate = sessionInfo.expirationDate;
|
|
27756
|
+
this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXTENDED, (expiresIn) => {
|
|
27757
|
+
this.info.expirationDate = Date.now() + expiresIn * 1000;
|
|
27758
|
+
});
|
|
27455
27759
|
}
|
|
27456
27760
|
}
|
|
27457
|
-
exports.SessionInfoManager = SessionInfoManager;
|
|
27458
|
-
//# sourceMappingURL=SessionInfoManager.js.map
|
|
27459
|
-
|
|
27460
|
-
/***/ }),
|
|
27461
|
-
|
|
27462
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/storage/BrowserStorage.js":
|
|
27463
|
-
/*!****************************************************************************************!*\
|
|
27464
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/storage/BrowserStorage.js ***!
|
|
27465
|
-
\****************************************************************************************/
|
|
27466
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
27467
27761
|
|
|
27468
|
-
|
|
27469
|
-
|
|
27470
|
-
|
|
27471
|
-
|
|
27472
|
-
|
|
27473
|
-
|
|
27474
|
-
|
|
27475
|
-
|
|
27476
|
-
|
|
27477
|
-
|
|
27478
|
-
|
|
27479
|
-
|
|
27480
|
-
|
|
27481
|
-
|
|
27482
|
-
|
|
27762
|
+
//
|
|
27763
|
+
// Copyright Inrupt Inc.
|
|
27764
|
+
//
|
|
27765
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27766
|
+
// of this software and associated documentation files (the "Software"), to deal in
|
|
27767
|
+
// the Software without restriction, including without limitation the rights to use,
|
|
27768
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
27769
|
+
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
27770
|
+
// subject to the following conditions:
|
|
27771
|
+
//
|
|
27772
|
+
// The above copyright notice and this permission notice shall be included in
|
|
27773
|
+
// all copies or substantial portions of the Software.
|
|
27774
|
+
//
|
|
27775
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
27776
|
+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
27777
|
+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
27778
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27779
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27780
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27781
|
+
//
|
|
27782
|
+
let defaultSession;
|
|
27783
|
+
/**
|
|
27784
|
+
* Obtain the {@link Session} used when not explicitly instantiating one yourself.
|
|
27785
|
+
*
|
|
27786
|
+
* When using the top-level exports {@link fetch}, {@link login}, {@link logout},
|
|
27787
|
+
* {@link handleIncomingRedirect}, {@link onLogin} and {@link onLogout}, these apply to an
|
|
27788
|
+
* implicitly-instantiated {@link Session}.
|
|
27789
|
+
* This function returns a reference to that Session in order to obtain e.g. the current user's
|
|
27790
|
+
* WebID.
|
|
27791
|
+
* @since 1.3.0
|
|
27792
|
+
*/
|
|
27793
|
+
function getDefaultSession() {
|
|
27794
|
+
if (typeof defaultSession === "undefined") {
|
|
27795
|
+
defaultSession = new Session();
|
|
27483
27796
|
}
|
|
27797
|
+
return defaultSession;
|
|
27484
27798
|
}
|
|
27485
|
-
|
|
27486
|
-
|
|
27487
|
-
|
|
27488
|
-
|
|
27799
|
+
/**
|
|
27800
|
+
* This function's signature is equal to `window.fetch`, but if the current user is authenticated
|
|
27801
|
+
* (see [[login]] and [[handleIncomingRedirect]]), requests made using it will include that user's
|
|
27802
|
+
* credentials. If not, this will behave just like the regular `window.fetch`.
|
|
27803
|
+
*
|
|
27804
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch}
|
|
27805
|
+
* @since 1.3.0
|
|
27806
|
+
*/
|
|
27807
|
+
/* eslint-disable-next-line no-shadow */
|
|
27808
|
+
const fetch = (...args) => {
|
|
27809
|
+
const session = getDefaultSession();
|
|
27810
|
+
return session.fetch(...args);
|
|
27811
|
+
};
|
|
27812
|
+
/**
|
|
27813
|
+
* Triggers the login process. Note that this method will redirect the user away from your app.
|
|
27814
|
+
*
|
|
27815
|
+
* @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider.
|
|
27816
|
+
* @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by [[handleIncomingRedirect]].
|
|
27817
|
+
* @since 1.3.0
|
|
27818
|
+
*/
|
|
27819
|
+
const login = (...args) => {
|
|
27820
|
+
const session = getDefaultSession();
|
|
27821
|
+
return session.login(...args);
|
|
27822
|
+
};
|
|
27823
|
+
/**
|
|
27824
|
+
* Logs the user out of the application.
|
|
27825
|
+
*
|
|
27826
|
+
* By default this does not log the user out of their Solid identity provider.
|
|
27827
|
+
* In order to do so, you must set the logoutType to `idp`. For usage details
|
|
27828
|
+
* see {@link Session.logout}.
|
|
27829
|
+
*
|
|
27830
|
+
* @since 1.3.0
|
|
27831
|
+
*/
|
|
27832
|
+
const logout = (...args) => {
|
|
27833
|
+
const session = getDefaultSession();
|
|
27834
|
+
return session.logout(...args);
|
|
27835
|
+
};
|
|
27836
|
+
/**
|
|
27837
|
+
* Completes the login process by processing the information provided by the Solid identity provider through redirect.
|
|
27838
|
+
*
|
|
27839
|
+
* @param url The URL of the page handling the redirect, including the query parameters — these contain the information to process the login.
|
|
27840
|
+
* @since 1.3.0
|
|
27841
|
+
*/
|
|
27842
|
+
const handleIncomingRedirect = (...args) => {
|
|
27843
|
+
const session = getDefaultSession();
|
|
27844
|
+
return session.handleIncomingRedirect(...args);
|
|
27845
|
+
};
|
|
27846
|
+
/**
|
|
27847
|
+
* Register a callback function to be called when a user completes login.
|
|
27848
|
+
*
|
|
27849
|
+
* The callback is called when {@link handleIncomingRedirect} completes successfully.
|
|
27850
|
+
* @since 1.3.0
|
|
27851
|
+
*
|
|
27852
|
+
* @param callback The function called when a user completes login.
|
|
27853
|
+
* @deprecated Prefer events.on(EVENTS.LOGIN, callback)
|
|
27489
27854
|
|
|
27490
|
-
|
|
27491
|
-
|
|
27492
|
-
|
|
27493
|
-
|
|
27494
|
-
|
|
27855
|
+
*/
|
|
27856
|
+
const onLogin = (...args) => {
|
|
27857
|
+
const session = getDefaultSession();
|
|
27858
|
+
return session.onLogin(...args);
|
|
27859
|
+
};
|
|
27860
|
+
/**
|
|
27861
|
+
* Register a callback function to be called when a user logs out:
|
|
27862
|
+
*
|
|
27863
|
+
* @param callback The function called when a user completes logout.
|
|
27864
|
+
* @since 1.3.0
|
|
27865
|
+
* @deprecated Prefer events.on(EVENTS.LOGOUT, callback)
|
|
27866
|
+
*
|
|
27867
|
+
*/
|
|
27868
|
+
const onLogout = (...args) => {
|
|
27869
|
+
const session = getDefaultSession();
|
|
27870
|
+
return session.onLogout(...args);
|
|
27871
|
+
};
|
|
27872
|
+
/**
|
|
27873
|
+
* Register a callback function to be called when a session is restored:
|
|
27874
|
+
*
|
|
27875
|
+
* @param callback The function called when a session is restored.
|
|
27876
|
+
* @since 1.3.0
|
|
27877
|
+
* @deprecated Prefer events.on(EVENTS.SESSION_RESTORED, callback)
|
|
27878
|
+
*/
|
|
27879
|
+
const onSessionRestore = (...args) => {
|
|
27880
|
+
const session = getDefaultSession();
|
|
27881
|
+
return session.onSessionRestore(...args);
|
|
27882
|
+
};
|
|
27883
|
+
/**
|
|
27884
|
+
* {@link SessionEventEmitter} instance to subscribe to events by the default session.
|
|
27885
|
+
*
|
|
27886
|
+
* @since 1.14.0
|
|
27887
|
+
*/
|
|
27888
|
+
const events = () => {
|
|
27889
|
+
return getDefaultSession().events;
|
|
27890
|
+
};
|
|
27495
27891
|
|
|
27496
|
-
"
|
|
27892
|
+
Object.defineProperty(exports, "ConfigurationError", ({
|
|
27893
|
+
enumerable: true,
|
|
27894
|
+
get: function () { return solidClientAuthnCore.ConfigurationError; }
|
|
27895
|
+
}));
|
|
27896
|
+
Object.defineProperty(exports, "EVENTS", ({
|
|
27897
|
+
enumerable: true,
|
|
27898
|
+
get: function () { return solidClientAuthnCore.EVENTS; }
|
|
27899
|
+
}));
|
|
27900
|
+
Object.defineProperty(exports, "InMemoryStorage", ({
|
|
27901
|
+
enumerable: true,
|
|
27902
|
+
get: function () { return solidClientAuthnCore.InMemoryStorage; }
|
|
27903
|
+
}));
|
|
27904
|
+
Object.defineProperty(exports, "NotImplementedError", ({
|
|
27905
|
+
enumerable: true,
|
|
27906
|
+
get: function () { return solidClientAuthnCore.NotImplementedError; }
|
|
27907
|
+
}));
|
|
27908
|
+
exports.Session = Session;
|
|
27909
|
+
exports.events = events;
|
|
27910
|
+
exports.fetch = fetch;
|
|
27911
|
+
exports.getClientAuthenticationWithDependencies = getClientAuthenticationWithDependencies;
|
|
27912
|
+
exports.getDefaultSession = getDefaultSession;
|
|
27913
|
+
exports.handleIncomingRedirect = handleIncomingRedirect;
|
|
27914
|
+
exports.login = login;
|
|
27915
|
+
exports.logout = logout;
|
|
27916
|
+
exports.onLogin = onLogin;
|
|
27917
|
+
exports.onLogout = onLogout;
|
|
27918
|
+
exports.onSessionRestore = onSessionRestore;
|
|
27919
|
+
//# sourceMappingURL=index.js.map
|
|
27497
27920
|
|
|
27498
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
27499
|
-
const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
|
|
27500
|
-
class StorageUtilityBrowser extends solid_client_authn_core_1.StorageUtility {
|
|
27501
|
-
constructor(secureStorage, insecureStorage) {
|
|
27502
|
-
super(secureStorage, insecureStorage);
|
|
27503
|
-
}
|
|
27504
|
-
}
|
|
27505
|
-
exports["default"] = StorageUtilityBrowser;
|
|
27506
|
-
//# sourceMappingURL=StorageUtility.js.map
|
|
27507
27921
|
|
|
27508
27922
|
/***/ }),
|
|
27509
27923
|
|