@pod-os/core 0.11.1-329cf1f.0 → 0.11.1-62e1055.0
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/index.js +437 -42
- package/lib/index.js +437 -42
- package/package.json +12 -12
package/lib/index.js
CHANGED
|
@@ -12860,39 +12860,65 @@ var PodOS = (() => {
|
|
|
12860
12860
|
"../node_modules/function-bind/implementation.js"(exports, module3) {
|
|
12861
12861
|
"use strict";
|
|
12862
12862
|
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
12863
|
-
var slice = Array.prototype.slice;
|
|
12864
12863
|
var toStr = Object.prototype.toString;
|
|
12864
|
+
var max2 = Math.max;
|
|
12865
12865
|
var funcType = "[object Function]";
|
|
12866
|
+
var concatty = function concatty2(a, b) {
|
|
12867
|
+
var arr = [];
|
|
12868
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
12869
|
+
arr[i] = a[i];
|
|
12870
|
+
}
|
|
12871
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
12872
|
+
arr[j + a.length] = b[j];
|
|
12873
|
+
}
|
|
12874
|
+
return arr;
|
|
12875
|
+
};
|
|
12876
|
+
var slicy = function slicy2(arrLike, offset3) {
|
|
12877
|
+
var arr = [];
|
|
12878
|
+
for (var i = offset3 || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
12879
|
+
arr[j] = arrLike[i];
|
|
12880
|
+
}
|
|
12881
|
+
return arr;
|
|
12882
|
+
};
|
|
12883
|
+
var joiny = function(arr, joiner) {
|
|
12884
|
+
var str = "";
|
|
12885
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
12886
|
+
str += arr[i];
|
|
12887
|
+
if (i + 1 < arr.length) {
|
|
12888
|
+
str += joiner;
|
|
12889
|
+
}
|
|
12890
|
+
}
|
|
12891
|
+
return str;
|
|
12892
|
+
};
|
|
12866
12893
|
module3.exports = function bind(that) {
|
|
12867
12894
|
var target5 = this;
|
|
12868
|
-
if (typeof target5 !== "function" || toStr.
|
|
12895
|
+
if (typeof target5 !== "function" || toStr.apply(target5) !== funcType) {
|
|
12869
12896
|
throw new TypeError(ERROR_MESSAGE + target5);
|
|
12870
12897
|
}
|
|
12871
|
-
var args =
|
|
12898
|
+
var args = slicy(arguments, 1);
|
|
12872
12899
|
var bound;
|
|
12873
12900
|
var binder = function() {
|
|
12874
12901
|
if (this instanceof bound) {
|
|
12875
12902
|
var result5 = target5.apply(
|
|
12876
12903
|
this,
|
|
12877
|
-
args
|
|
12904
|
+
concatty(args, arguments)
|
|
12878
12905
|
);
|
|
12879
12906
|
if (Object(result5) === result5) {
|
|
12880
12907
|
return result5;
|
|
12881
12908
|
}
|
|
12882
12909
|
return this;
|
|
12883
|
-
} else {
|
|
12884
|
-
return target5.apply(
|
|
12885
|
-
that,
|
|
12886
|
-
args.concat(slice.call(arguments))
|
|
12887
|
-
);
|
|
12888
12910
|
}
|
|
12911
|
+
return target5.apply(
|
|
12912
|
+
that,
|
|
12913
|
+
concatty(args, arguments)
|
|
12914
|
+
);
|
|
12889
12915
|
};
|
|
12890
|
-
var boundLength =
|
|
12916
|
+
var boundLength = max2(0, target5.length - args.length);
|
|
12891
12917
|
var boundArgs = [];
|
|
12892
12918
|
for (var i = 0; i < boundLength; i++) {
|
|
12893
|
-
boundArgs
|
|
12919
|
+
boundArgs[i] = "$" + i;
|
|
12894
12920
|
}
|
|
12895
|
-
bound = Function("binder", "return function (" + boundArgs
|
|
12921
|
+
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
12896
12922
|
if (target5.prototype) {
|
|
12897
12923
|
var Empty = function Empty2() {
|
|
12898
12924
|
};
|
|
@@ -12914,12 +12940,14 @@ var PodOS = (() => {
|
|
|
12914
12940
|
}
|
|
12915
12941
|
});
|
|
12916
12942
|
|
|
12917
|
-
// ../node_modules/
|
|
12918
|
-
var
|
|
12919
|
-
"../node_modules/
|
|
12943
|
+
// ../node_modules/hasown/index.js
|
|
12944
|
+
var require_hasown = __commonJS({
|
|
12945
|
+
"../node_modules/hasown/index.js"(exports, module3) {
|
|
12920
12946
|
"use strict";
|
|
12947
|
+
var call = Function.prototype.call;
|
|
12948
|
+
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
12921
12949
|
var bind = require_function_bind();
|
|
12922
|
-
module3.exports = bind.call(
|
|
12950
|
+
module3.exports = bind.call(call, $hasOwn);
|
|
12923
12951
|
}
|
|
12924
12952
|
});
|
|
12925
12953
|
|
|
@@ -13121,7 +13149,7 @@ var PodOS = (() => {
|
|
|
13121
13149
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
13122
13150
|
};
|
|
13123
13151
|
var bind = require_function_bind();
|
|
13124
|
-
var hasOwn =
|
|
13152
|
+
var hasOwn = require_hasown();
|
|
13125
13153
|
var $concat = bind.call(Function.call, Array.prototype.concat);
|
|
13126
13154
|
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
|
|
13127
13155
|
var $replace = bind.call(Function.call, String.prototype.replace);
|
|
@@ -13230,16 +13258,163 @@ var PodOS = (() => {
|
|
|
13230
13258
|
}
|
|
13231
13259
|
});
|
|
13232
13260
|
|
|
13261
|
+
// ../node_modules/has-property-descriptors/index.js
|
|
13262
|
+
var require_has_property_descriptors = __commonJS({
|
|
13263
|
+
"../node_modules/has-property-descriptors/index.js"(exports, module3) {
|
|
13264
|
+
"use strict";
|
|
13265
|
+
var GetIntrinsic = require_get_intrinsic();
|
|
13266
|
+
var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
|
|
13267
|
+
var hasPropertyDescriptors = function hasPropertyDescriptors2() {
|
|
13268
|
+
if ($defineProperty) {
|
|
13269
|
+
try {
|
|
13270
|
+
$defineProperty({}, "a", { value: 1 });
|
|
13271
|
+
return true;
|
|
13272
|
+
} catch (e) {
|
|
13273
|
+
return false;
|
|
13274
|
+
}
|
|
13275
|
+
}
|
|
13276
|
+
return false;
|
|
13277
|
+
};
|
|
13278
|
+
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
|
|
13279
|
+
if (!hasPropertyDescriptors()) {
|
|
13280
|
+
return null;
|
|
13281
|
+
}
|
|
13282
|
+
try {
|
|
13283
|
+
return $defineProperty([], "length", { value: 1 }).length !== 1;
|
|
13284
|
+
} catch (e) {
|
|
13285
|
+
return true;
|
|
13286
|
+
}
|
|
13287
|
+
};
|
|
13288
|
+
module3.exports = hasPropertyDescriptors;
|
|
13289
|
+
}
|
|
13290
|
+
});
|
|
13291
|
+
|
|
13292
|
+
// ../node_modules/gopd/index.js
|
|
13293
|
+
var require_gopd = __commonJS({
|
|
13294
|
+
"../node_modules/gopd/index.js"(exports, module3) {
|
|
13295
|
+
"use strict";
|
|
13296
|
+
var GetIntrinsic = require_get_intrinsic();
|
|
13297
|
+
var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true);
|
|
13298
|
+
if ($gOPD) {
|
|
13299
|
+
try {
|
|
13300
|
+
$gOPD([], "length");
|
|
13301
|
+
} catch (e) {
|
|
13302
|
+
$gOPD = null;
|
|
13303
|
+
}
|
|
13304
|
+
}
|
|
13305
|
+
module3.exports = $gOPD;
|
|
13306
|
+
}
|
|
13307
|
+
});
|
|
13308
|
+
|
|
13309
|
+
// ../node_modules/define-data-property/index.js
|
|
13310
|
+
var require_define_data_property = __commonJS({
|
|
13311
|
+
"../node_modules/define-data-property/index.js"(exports, module3) {
|
|
13312
|
+
"use strict";
|
|
13313
|
+
var hasPropertyDescriptors = require_has_property_descriptors()();
|
|
13314
|
+
var GetIntrinsic = require_get_intrinsic();
|
|
13315
|
+
var $defineProperty = hasPropertyDescriptors && GetIntrinsic("%Object.defineProperty%", true);
|
|
13316
|
+
if ($defineProperty) {
|
|
13317
|
+
try {
|
|
13318
|
+
$defineProperty({}, "a", { value: 1 });
|
|
13319
|
+
} catch (e) {
|
|
13320
|
+
$defineProperty = false;
|
|
13321
|
+
}
|
|
13322
|
+
}
|
|
13323
|
+
var $SyntaxError = GetIntrinsic("%SyntaxError%");
|
|
13324
|
+
var $TypeError = GetIntrinsic("%TypeError%");
|
|
13325
|
+
var gopd = require_gopd();
|
|
13326
|
+
module3.exports = function defineDataProperty(obj, property3, value6) {
|
|
13327
|
+
if (!obj || typeof obj !== "object" && typeof obj !== "function") {
|
|
13328
|
+
throw new $TypeError("`obj` must be an object or a function`");
|
|
13329
|
+
}
|
|
13330
|
+
if (typeof property3 !== "string" && typeof property3 !== "symbol") {
|
|
13331
|
+
throw new $TypeError("`property` must be a string or a symbol`");
|
|
13332
|
+
}
|
|
13333
|
+
if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) {
|
|
13334
|
+
throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");
|
|
13335
|
+
}
|
|
13336
|
+
if (arguments.length > 4 && typeof arguments[4] !== "boolean" && arguments[4] !== null) {
|
|
13337
|
+
throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");
|
|
13338
|
+
}
|
|
13339
|
+
if (arguments.length > 5 && typeof arguments[5] !== "boolean" && arguments[5] !== null) {
|
|
13340
|
+
throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");
|
|
13341
|
+
}
|
|
13342
|
+
if (arguments.length > 6 && typeof arguments[6] !== "boolean") {
|
|
13343
|
+
throw new $TypeError("`loose`, if provided, must be a boolean");
|
|
13344
|
+
}
|
|
13345
|
+
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
|
|
13346
|
+
var nonWritable = arguments.length > 4 ? arguments[4] : null;
|
|
13347
|
+
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
|
|
13348
|
+
var loose = arguments.length > 6 ? arguments[6] : false;
|
|
13349
|
+
var desc = !!gopd && gopd(obj, property3);
|
|
13350
|
+
if ($defineProperty) {
|
|
13351
|
+
$defineProperty(obj, property3, {
|
|
13352
|
+
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
|
|
13353
|
+
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
|
|
13354
|
+
value: value6,
|
|
13355
|
+
writable: nonWritable === null && desc ? desc.writable : !nonWritable
|
|
13356
|
+
});
|
|
13357
|
+
} else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) {
|
|
13358
|
+
obj[property3] = value6;
|
|
13359
|
+
} else {
|
|
13360
|
+
throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
|
|
13361
|
+
}
|
|
13362
|
+
};
|
|
13363
|
+
}
|
|
13364
|
+
});
|
|
13365
|
+
|
|
13366
|
+
// ../node_modules/set-function-length/index.js
|
|
13367
|
+
var require_set_function_length = __commonJS({
|
|
13368
|
+
"../node_modules/set-function-length/index.js"(exports, module3) {
|
|
13369
|
+
"use strict";
|
|
13370
|
+
var GetIntrinsic = require_get_intrinsic();
|
|
13371
|
+
var define2 = require_define_data_property();
|
|
13372
|
+
var hasDescriptors = require_has_property_descriptors()();
|
|
13373
|
+
var gOPD = require_gopd();
|
|
13374
|
+
var $TypeError = GetIntrinsic("%TypeError%");
|
|
13375
|
+
var $floor = GetIntrinsic("%Math.floor%");
|
|
13376
|
+
module3.exports = function setFunctionLength(fn2, length2) {
|
|
13377
|
+
if (typeof fn2 !== "function") {
|
|
13378
|
+
throw new $TypeError("`fn` is not a function");
|
|
13379
|
+
}
|
|
13380
|
+
if (typeof length2 !== "number" || length2 < 0 || length2 > 4294967295 || $floor(length2) !== length2) {
|
|
13381
|
+
throw new $TypeError("`length` must be a positive 32-bit integer");
|
|
13382
|
+
}
|
|
13383
|
+
var loose = arguments.length > 2 && !!arguments[2];
|
|
13384
|
+
var functionLengthIsConfigurable = true;
|
|
13385
|
+
var functionLengthIsWritable = true;
|
|
13386
|
+
if ("length" in fn2 && gOPD) {
|
|
13387
|
+
var desc = gOPD(fn2, "length");
|
|
13388
|
+
if (desc && !desc.configurable) {
|
|
13389
|
+
functionLengthIsConfigurable = false;
|
|
13390
|
+
}
|
|
13391
|
+
if (desc && !desc.writable) {
|
|
13392
|
+
functionLengthIsWritable = false;
|
|
13393
|
+
}
|
|
13394
|
+
}
|
|
13395
|
+
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
|
|
13396
|
+
if (hasDescriptors) {
|
|
13397
|
+
define2(fn2, "length", length2, true, true);
|
|
13398
|
+
} else {
|
|
13399
|
+
define2(fn2, "length", length2);
|
|
13400
|
+
}
|
|
13401
|
+
}
|
|
13402
|
+
return fn2;
|
|
13403
|
+
};
|
|
13404
|
+
}
|
|
13405
|
+
});
|
|
13406
|
+
|
|
13233
13407
|
// ../node_modules/call-bind/index.js
|
|
13234
13408
|
var require_call_bind = __commonJS({
|
|
13235
13409
|
"../node_modules/call-bind/index.js"(exports, module3) {
|
|
13236
13410
|
"use strict";
|
|
13237
13411
|
var bind = require_function_bind();
|
|
13238
13412
|
var GetIntrinsic = require_get_intrinsic();
|
|
13413
|
+
var setFunctionLength = require_set_function_length();
|
|
13414
|
+
var $TypeError = GetIntrinsic("%TypeError%");
|
|
13239
13415
|
var $apply = GetIntrinsic("%Function.prototype.apply%");
|
|
13240
13416
|
var $call = GetIntrinsic("%Function.prototype.call%");
|
|
13241
13417
|
var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply);
|
|
13242
|
-
var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true);
|
|
13243
13418
|
var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
|
|
13244
13419
|
var $max = GetIntrinsic("%Math.max%");
|
|
13245
13420
|
if ($defineProperty) {
|
|
@@ -13250,18 +13425,15 @@ var PodOS = (() => {
|
|
|
13250
13425
|
}
|
|
13251
13426
|
}
|
|
13252
13427
|
module3.exports = function callBind(originalFunction) {
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
var desc = $gOPD(func, "length");
|
|
13256
|
-
if (desc.configurable) {
|
|
13257
|
-
$defineProperty(
|
|
13258
|
-
func,
|
|
13259
|
-
"length",
|
|
13260
|
-
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
|
13261
|
-
);
|
|
13262
|
-
}
|
|
13428
|
+
if (typeof originalFunction !== "function") {
|
|
13429
|
+
throw new $TypeError("a function is required");
|
|
13263
13430
|
}
|
|
13264
|
-
|
|
13431
|
+
var func = $reflectApply(bind, $call, arguments);
|
|
13432
|
+
return setFunctionLength(
|
|
13433
|
+
func,
|
|
13434
|
+
1 + $max(0, originalFunction.length - (arguments.length - 1)),
|
|
13435
|
+
true
|
|
13436
|
+
);
|
|
13265
13437
|
};
|
|
13266
13438
|
var applyBind = function applyBind2() {
|
|
13267
13439
|
return $reflectApply(bind, $apply, arguments);
|
|
@@ -13513,6 +13685,12 @@ var PodOS = (() => {
|
|
|
13513
13685
|
if (isString(obj)) {
|
|
13514
13686
|
return markBoxed(inspect(String(obj)));
|
|
13515
13687
|
}
|
|
13688
|
+
if (typeof window !== "undefined" && obj === window) {
|
|
13689
|
+
return "{ [object Window] }";
|
|
13690
|
+
}
|
|
13691
|
+
if (obj === global) {
|
|
13692
|
+
return "{ [object globalThis] }";
|
|
13693
|
+
}
|
|
13516
13694
|
if (!isDate(obj) && !isRegExp(obj)) {
|
|
13517
13695
|
var ys = arrObjKeys(obj, inspect);
|
|
13518
13696
|
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
@@ -28317,9 +28495,9 @@ var PodOS = (() => {
|
|
|
28317
28495
|
}
|
|
28318
28496
|
});
|
|
28319
28497
|
|
|
28320
|
-
// ../node_modules/cross-fetch/dist/browser-ponyfill.js
|
|
28498
|
+
// ../node_modules/rdflib/node_modules/cross-fetch/dist/browser-ponyfill.js
|
|
28321
28499
|
var require_browser_ponyfill = __commonJS({
|
|
28322
|
-
"../node_modules/cross-fetch/dist/browser-ponyfill.js"(exports, module3) {
|
|
28500
|
+
"../node_modules/rdflib/node_modules/cross-fetch/dist/browser-ponyfill.js"(exports, module3) {
|
|
28323
28501
|
var global3 = typeof self !== "undefined" ? self : exports;
|
|
28324
28502
|
var __self__ = function() {
|
|
28325
28503
|
function F() {
|
|
@@ -31857,6 +32035,7 @@ var PodOS = (() => {
|
|
|
31857
32035
|
var SOLID_CLIENT_AUTHN_KEY_PREFIX = "solidClientAuthn:";
|
|
31858
32036
|
var PREFERRED_SIGNING_ALG = ["ES256", "RS256"];
|
|
31859
32037
|
var EVENTS = {
|
|
32038
|
+
// Note that an `error` events MUST be listened to: https://nodejs.org/dist/latest-v16.x/docs/api/events.html#error-events.
|
|
31860
32039
|
ERROR: "error",
|
|
31861
32040
|
LOGIN: "login",
|
|
31862
32041
|
LOGOUT: "logout",
|
|
@@ -31872,6 +32051,9 @@ var PodOS = (() => {
|
|
|
31872
32051
|
var SCOPE_WEBID = "webid";
|
|
31873
32052
|
var DEFAULT_SCOPES = [SCOPE_OPENID, SCOPE_OFFLINE, SCOPE_WEBID].join(" ");
|
|
31874
32053
|
var buildProxyHandler = (toExclude, errorMessage) => ({
|
|
32054
|
+
// This proxy is only a temporary measure until Session no longer extends
|
|
32055
|
+
// SessionEventEmitter, and the proxying is no longer necessary.
|
|
32056
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31875
32057
|
get(target5, prop, receiver2) {
|
|
31876
32058
|
if (!Object.getOwnPropertyNames(import_events.EventEmitter).includes(prop) && Object.getOwnPropertyNames(toExclude).includes(prop)) {
|
|
31877
32059
|
throw new Error(`${errorMessage}: [${prop}] is not supported`);
|
|
@@ -31884,6 +32066,11 @@ var PodOS = (() => {
|
|
|
31884
32066
|
this.handleables = handleables;
|
|
31885
32067
|
this.handleables = handleables;
|
|
31886
32068
|
}
|
|
32069
|
+
/**
|
|
32070
|
+
* Helper function that will asynchronously determine the proper handler to use. If multiple
|
|
32071
|
+
* handlers can handle, it will choose the first one in the list
|
|
32072
|
+
* @param params Paramerters to feed to the handler
|
|
32073
|
+
*/
|
|
31887
32074
|
async getProperHandler(params2) {
|
|
31888
32075
|
const canHandleList = await Promise.all(this.handleables.map((handleable) => handleable.canHandle(...params2)));
|
|
31889
32076
|
for (let i = 0; i < canHandleList.length; i += 1) {
|
|
@@ -31970,12 +32157,28 @@ var PodOS = (() => {
|
|
|
31970
32157
|
}
|
|
31971
32158
|
async handleRedirect({ oidcLoginOptions, state: state2, codeVerifier, targetUrl: targetUrl3 }) {
|
|
31972
32159
|
await Promise.all([
|
|
32160
|
+
// We use the OAuth 'state' value (which should be crypto-random) as
|
|
32161
|
+
// the key in our storage to store our actual SessionID. We do this
|
|
32162
|
+
// 'cos we'll need to lookup our session information again when the
|
|
32163
|
+
// browser is redirected back to us (i.e. the OAuth client
|
|
32164
|
+
// application) from the Authorization Server.
|
|
32165
|
+
// We don't want to use our session ID as the OAuth 'state' value, as
|
|
32166
|
+
// that session ID can be any developer-specified value, and therefore
|
|
32167
|
+
// may not be appropriate (since the OAuth 'state' value should really
|
|
32168
|
+
// be an unguessable crypto-random value).
|
|
32169
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
31973
32170
|
this.storageUtility.setForUser(state2, {
|
|
31974
32171
|
sessionId: oidcLoginOptions.sessionId
|
|
31975
32172
|
}),
|
|
32173
|
+
// Store our login-process state using the session ID as the key.
|
|
32174
|
+
// Strictly speaking, this indirection from our OAuth state value to
|
|
32175
|
+
// our session ID is unnecessary, but it provides a slightly cleaner
|
|
32176
|
+
// separation of concerns.
|
|
31976
32177
|
this.storageUtility.setForUser(oidcLoginOptions.sessionId, {
|
|
32178
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
31977
32179
|
codeVerifier,
|
|
31978
32180
|
issuer: oidcLoginOptions.issuer.toString(),
|
|
32181
|
+
// The redirect URL is read after redirect, so it must be stored now.
|
|
31979
32182
|
redirectUrl: oidcLoginOptions.redirectUrl,
|
|
31980
32183
|
dpop: oidcLoginOptions.dpop ? "true" : "false"
|
|
31981
32184
|
})
|
|
@@ -32059,18 +32262,36 @@ var PodOS = (() => {
|
|
|
32059
32262
|
get(_) {
|
|
32060
32263
|
throw new Error("Not implemented");
|
|
32061
32264
|
}
|
|
32265
|
+
// eslint-disable-next-line class-methods-use-this
|
|
32062
32266
|
async getAll() {
|
|
32063
32267
|
throw new Error("Not implemented");
|
|
32064
32268
|
}
|
|
32269
|
+
/**
|
|
32270
|
+
* This function removes all session-related information from storage.
|
|
32271
|
+
* @param sessionId the session identifier
|
|
32272
|
+
* @param storage the storage where session info is stored
|
|
32273
|
+
* @hidden
|
|
32274
|
+
*/
|
|
32065
32275
|
async clear(sessionId) {
|
|
32066
32276
|
return clear(sessionId, this.storageUtility);
|
|
32067
32277
|
}
|
|
32278
|
+
/**
|
|
32279
|
+
* Registers a new session, so that its ID can be retrieved.
|
|
32280
|
+
* @param sessionId
|
|
32281
|
+
*/
|
|
32068
32282
|
async register(_sessionId) {
|
|
32069
32283
|
throw new Error("Not implemented");
|
|
32070
32284
|
}
|
|
32285
|
+
/**
|
|
32286
|
+
* Returns all the registered session IDs. Differs from getAll, which also
|
|
32287
|
+
* returns additional session information.
|
|
32288
|
+
*/
|
|
32071
32289
|
async getRegisteredSessionIdAll() {
|
|
32072
32290
|
throw new Error("Not implemented");
|
|
32073
32291
|
}
|
|
32292
|
+
/**
|
|
32293
|
+
* Deletes all information about all sessions, including their registrations.
|
|
32294
|
+
*/
|
|
32074
32295
|
async clearAll() {
|
|
32075
32296
|
throw new Error("Not implemented");
|
|
32076
32297
|
}
|
|
@@ -32134,6 +32355,8 @@ var PodOS = (() => {
|
|
|
32134
32355
|
}, issuerConfig);
|
|
32135
32356
|
}
|
|
32136
32357
|
await storageUtility.setForUser(options.sessionId, {
|
|
32358
|
+
// If the client is either static or solid-oidc compliant, its client ID cannot be undefined.
|
|
32359
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
32137
32360
|
clientId: options.clientId
|
|
32138
32361
|
});
|
|
32139
32362
|
if (options.clientSecret) {
|
|
@@ -32147,6 +32370,7 @@ var PodOS = (() => {
|
|
|
32147
32370
|
});
|
|
32148
32371
|
}
|
|
32149
32372
|
return {
|
|
32373
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
32150
32374
|
clientId: options.clientId,
|
|
32151
32375
|
clientSecret: options.clientSecret,
|
|
32152
32376
|
clientName: options.clientName,
|
|
@@ -32287,17 +32511,20 @@ var PodOS = (() => {
|
|
|
32287
32511
|
}
|
|
32288
32512
|
};
|
|
32289
32513
|
var ConfigurationError = class extends Error {
|
|
32514
|
+
/* istanbul ignore next */
|
|
32290
32515
|
constructor(message4) {
|
|
32291
32516
|
super(message4);
|
|
32292
32517
|
}
|
|
32293
32518
|
};
|
|
32294
32519
|
var InvalidResponseError = class extends Error {
|
|
32520
|
+
/* istanbul ignore next */
|
|
32295
32521
|
constructor(missingFields) {
|
|
32296
32522
|
super(`Invalid response from OIDC provider: missing fields ${missingFields}`);
|
|
32297
32523
|
this.missingFields = missingFields;
|
|
32298
32524
|
}
|
|
32299
32525
|
};
|
|
32300
32526
|
var OidcProviderError = class extends Error {
|
|
32527
|
+
/* istanbul ignore next */
|
|
32301
32528
|
constructor(message4, error5, errorDescription) {
|
|
32302
32529
|
super(message4);
|
|
32303
32530
|
this.error = error5;
|
|
@@ -32371,7 +32598,10 @@ var PodOS = (() => {
|
|
|
32371
32598
|
}
|
|
32372
32599
|
var computeRefreshDelay = (expiresIn) => {
|
|
32373
32600
|
if (expiresIn !== void 0) {
|
|
32374
|
-
return expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS > 0 ?
|
|
32601
|
+
return expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS > 0 ? (
|
|
32602
|
+
// We want to refresh the token 5 seconds before they actually expire.
|
|
32603
|
+
expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS
|
|
32604
|
+
) : expiresIn;
|
|
32375
32605
|
}
|
|
32376
32606
|
return DEFAULT_EXPIRATION_TIME_SECONDS;
|
|
32377
32607
|
};
|
|
@@ -32384,7 +32614,14 @@ var PodOS = (() => {
|
|
|
32384
32614
|
const proactivelyRefreshToken = async () => {
|
|
32385
32615
|
var _a2, _b, _c, _d;
|
|
32386
32616
|
try {
|
|
32387
|
-
const { accessToken: refreshedAccessToken, refreshToken, expiresIn } = await refreshAccessToken(
|
|
32617
|
+
const { accessToken: refreshedAccessToken, refreshToken, expiresIn } = await refreshAccessToken(
|
|
32618
|
+
currentRefreshOptions,
|
|
32619
|
+
// If currentRefreshOptions is defined, options is necessarily defined too.
|
|
32620
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
32621
|
+
options.dpopKey,
|
|
32622
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
32623
|
+
options.eventEmitter
|
|
32624
|
+
);
|
|
32388
32625
|
currentAccessToken = refreshedAccessToken;
|
|
32389
32626
|
if (refreshToken !== void 0) {
|
|
32390
32627
|
currentRefreshOptions.refreshToken = refreshToken;
|
|
@@ -32402,7 +32639,12 @@ var PodOS = (() => {
|
|
|
32402
32639
|
}
|
|
32403
32640
|
}
|
|
32404
32641
|
};
|
|
32405
|
-
latestTimeout = setTimeout(
|
|
32642
|
+
latestTimeout = setTimeout(
|
|
32643
|
+
proactivelyRefreshToken,
|
|
32644
|
+
// If currentRefreshOptions is defined, options is necessarily defined too.
|
|
32645
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
32646
|
+
computeRefreshDelay(options.expiresIn) * 1e3
|
|
32647
|
+
);
|
|
32406
32648
|
(_a = options.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(EVENTS.TIMEOUT_SET, latestTimeout);
|
|
32407
32649
|
} else if (options !== void 0 && options.eventEmitter !== void 0) {
|
|
32408
32650
|
const expirationTimeout = setTimeout(() => {
|
|
@@ -32418,7 +32660,14 @@ var PodOS = (() => {
|
|
|
32418
32660
|
}
|
|
32419
32661
|
const hasBeenRedirected = response6.url !== url7;
|
|
32420
32662
|
if (hasBeenRedirected && (options === null || options === void 0 ? void 0 : options.dpopKey) !== void 0) {
|
|
32421
|
-
response6 = await makeAuthenticatedRequest(
|
|
32663
|
+
response6 = await makeAuthenticatedRequest(
|
|
32664
|
+
unauthFetch,
|
|
32665
|
+
currentAccessToken,
|
|
32666
|
+
// Replace the original target IRI (`url`) by the redirection target
|
|
32667
|
+
response6.url,
|
|
32668
|
+
requestInit,
|
|
32669
|
+
options.dpopKey
|
|
32670
|
+
);
|
|
32422
32671
|
}
|
|
32423
32672
|
return response6;
|
|
32424
32673
|
};
|
|
@@ -32460,6 +32709,7 @@ var PodOS = (() => {
|
|
|
32460
32709
|
}
|
|
32461
32710
|
const signingAlg = determineSigningAlg(issuerConfig.idTokenSigningAlgValuesSupported, PREFERRED_SIGNING_ALG);
|
|
32462
32711
|
const config = {
|
|
32712
|
+
/* eslint-disable camelcase */
|
|
32463
32713
|
client_name: options.clientName,
|
|
32464
32714
|
application_type: "web",
|
|
32465
32715
|
redirect_uris: [(_a = options.redirectUrl) === null || _a === void 0 ? void 0 : _a.toString()],
|
|
@@ -32467,6 +32717,7 @@ var PodOS = (() => {
|
|
|
32467
32717
|
token_endpoint_auth_method: "client_secret_basic",
|
|
32468
32718
|
id_token_signed_response_alg: signingAlg,
|
|
32469
32719
|
grant_types: ["authorization_code", "refresh_token"]
|
|
32720
|
+
/* eslint-enable camelcase */
|
|
32470
32721
|
};
|
|
32471
32722
|
const headers = {
|
|
32472
32723
|
"Content-Type": "application/json"
|
|
@@ -32558,11 +32809,13 @@ var PodOS = (() => {
|
|
|
32558
32809
|
headers.Authorization = `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`;
|
|
32559
32810
|
}
|
|
32560
32811
|
const requestBody = {
|
|
32812
|
+
/* eslint-disable camelcase */
|
|
32561
32813
|
grant_type: data2.grantType,
|
|
32562
32814
|
redirect_uri: data2.redirectUrl,
|
|
32563
32815
|
code: data2.code,
|
|
32564
32816
|
code_verifier: data2.codeVerifier,
|
|
32565
32817
|
client_id: client.clientId
|
|
32818
|
+
/* eslint-enable camelcase */
|
|
32566
32819
|
};
|
|
32567
32820
|
const tokenRequestInit = {
|
|
32568
32821
|
method: "POST",
|
|
@@ -32586,7 +32839,26 @@ var PodOS = (() => {
|
|
|
32586
32839
|
let signinResponse;
|
|
32587
32840
|
try {
|
|
32588
32841
|
const client = new import_oidc_client.OidcClient({
|
|
32842
|
+
// TODO: We should look at the various interfaces being used for storage,
|
|
32843
|
+
// i.e. between oidc-client-js (WebStorageStoreState), localStorage
|
|
32844
|
+
// (which has an interface Storage), and our own proprietary interface
|
|
32845
|
+
// IStorage - i.e. we should really just be using the browser Web Storage
|
|
32846
|
+
// API, e.g. "stateStore: window.localStorage,".
|
|
32847
|
+
// We are instantiating a new instance here, so the only value we need to
|
|
32848
|
+
// explicitly provide is the response mode (default otherwise will look
|
|
32849
|
+
// for a hash '#' fragment!).
|
|
32850
|
+
// eslint-disable-next-line camelcase
|
|
32589
32851
|
response_mode: "query",
|
|
32852
|
+
// The userinfo endpoint on NSS fails, so disable this for now
|
|
32853
|
+
// Note that in Solid, information should be retrieved from the
|
|
32854
|
+
// profile referenced by the WebId.
|
|
32855
|
+
// TODO: Note that this is heavy-handed, and that this userinfo check
|
|
32856
|
+
// verifies that the `sub` claim in the id token you get along with the
|
|
32857
|
+
// access token matches the sub claim associated with the access token at
|
|
32858
|
+
// the userinfo endpoint.
|
|
32859
|
+
// That is a useful check, and in the future it should be only disabled
|
|
32860
|
+
// against NSS, and not in general.
|
|
32861
|
+
// Issue tracker: https://github.com/solid/node-solid-server/issues/1490
|
|
32590
32862
|
loadUserInfo: false
|
|
32591
32863
|
});
|
|
32592
32864
|
signinResponse = await client.processSigninResponse(redirectUrl);
|
|
@@ -32607,6 +32879,13 @@ var PodOS = (() => {
|
|
|
32607
32879
|
accessToken: signinResponse.access_token,
|
|
32608
32880
|
idToken: signinResponse.id_token,
|
|
32609
32881
|
webId,
|
|
32882
|
+
// Although not a field in the TypeScript response interface, the refresh
|
|
32883
|
+
// token (which can optionally come back with the access token (if, as per
|
|
32884
|
+
// the OAuth2 spec, we requested one using the scope of 'offline_access')
|
|
32885
|
+
// will be included in the signin response object.
|
|
32886
|
+
// eslint-disable-next-line camelcase
|
|
32887
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
32888
|
+
// @ts-ignore
|
|
32610
32889
|
refreshToken: signinResponse.refresh_token
|
|
32611
32890
|
};
|
|
32612
32891
|
} catch (err) {
|
|
@@ -32642,6 +32921,8 @@ var PodOS = (() => {
|
|
|
32642
32921
|
let authHeader = {};
|
|
32643
32922
|
if (client.clientSecret !== void 0) {
|
|
32644
32923
|
authHeader = {
|
|
32924
|
+
// We assume that client_secret_basic is the client authentication method.
|
|
32925
|
+
// TODO: Get the authentication method from the IClient configuration object.
|
|
32645
32926
|
Authorization: `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`
|
|
32646
32927
|
};
|
|
32647
32928
|
} else if (isValidUrl2(client.clientId)) {
|
|
@@ -32678,13 +32959,28 @@ var PodOS = (() => {
|
|
|
32678
32959
|
cleanedUrl.searchParams.delete("code");
|
|
32679
32960
|
cleanedUrl.searchParams.delete("state");
|
|
32680
32961
|
cleanedUrl.hash = "";
|
|
32681
|
-
if (
|
|
32962
|
+
if (
|
|
32963
|
+
// The trailing slash is present in the original redirect URL
|
|
32964
|
+
redirectUrl.includes(`${cleanedUrl.origin}/`)
|
|
32965
|
+
) {
|
|
32682
32966
|
return cleanedUrl.href;
|
|
32683
32967
|
}
|
|
32684
|
-
return `${cleanedUrl.origin}${cleanedUrl.href.substring(
|
|
32968
|
+
return `${cleanedUrl.origin}${cleanedUrl.href.substring(
|
|
32969
|
+
// Adds 1 to the origin length to remove the trailing slash
|
|
32970
|
+
cleanedUrl.origin.length + 1
|
|
32971
|
+
)}`;
|
|
32685
32972
|
}
|
|
32686
32973
|
async function clearOidcPersistentStorage() {
|
|
32687
32974
|
const client = new import_oidc_client.OidcClient({
|
|
32975
|
+
// TODO: We should look at the various interfaces being used for storage,
|
|
32976
|
+
// i.e. between oidc-client-js (WebStorageStoreState), localStorage
|
|
32977
|
+
// (which has an interface Storage), and our own proprietary interface
|
|
32978
|
+
// IStorage - i.e. we should really just be using the browser Web Storage
|
|
32979
|
+
// API, e.g. "stateStore: window.localStorage,".
|
|
32980
|
+
// We are instantiating a new instance here, so the only value we need to
|
|
32981
|
+
// explicitly provide is the response mode (default otherwise will look
|
|
32982
|
+
// for a hash '#' fragment!).
|
|
32983
|
+
// eslint-disable-next-line camelcase
|
|
32688
32984
|
response_mode: "query"
|
|
32689
32985
|
});
|
|
32690
32986
|
await client.clearStaleState(new import_oidc_client.WebStorageStateStore({}));
|
|
@@ -32718,6 +33014,7 @@ var PodOS = (() => {
|
|
|
32718
33014
|
await this.loginHandler.handle({
|
|
32719
33015
|
...options,
|
|
32720
33016
|
redirectUrl,
|
|
33017
|
+
// If no clientName is provided, the clientId may be used instead.
|
|
32721
33018
|
clientName: (_b = options.clientName) !== null && _b !== void 0 ? _b : options.clientId,
|
|
32722
33019
|
eventEmitter
|
|
32723
33020
|
});
|
|
@@ -32734,7 +33031,7 @@ var PodOS = (() => {
|
|
|
32734
33031
|
const redirectInfo = await this.redirectHandler.handle(url7, eventEmitter);
|
|
32735
33032
|
this.fetch = redirectInfo.fetch.bind(window);
|
|
32736
33033
|
this.boundLogout = redirectInfo.getLogoutUrl;
|
|
32737
|
-
this.cleanUrlAfterRedirect(url7);
|
|
33034
|
+
await this.cleanUrlAfterRedirect(url7);
|
|
32738
33035
|
return {
|
|
32739
33036
|
isLoggedIn: redirectInfo.isLoggedIn,
|
|
32740
33037
|
webId: redirectInfo.webId,
|
|
@@ -32742,13 +33039,13 @@ var PodOS = (() => {
|
|
|
32742
33039
|
expirationDate: redirectInfo.expirationDate
|
|
32743
33040
|
};
|
|
32744
33041
|
} catch (err) {
|
|
32745
|
-
this.cleanUrlAfterRedirect(url7);
|
|
33042
|
+
await this.cleanUrlAfterRedirect(url7);
|
|
32746
33043
|
eventEmitter.emit(EVENTS.ERROR, "redirect", err);
|
|
32747
33044
|
return void 0;
|
|
32748
33045
|
}
|
|
32749
33046
|
};
|
|
32750
33047
|
}
|
|
32751
|
-
cleanUrlAfterRedirect(url7) {
|
|
33048
|
+
async cleanUrlAfterRedirect(url7) {
|
|
32752
33049
|
const cleanedUpUrl = new URL(url7);
|
|
32753
33050
|
cleanedUpUrl.searchParams.delete("state");
|
|
32754
33051
|
cleanedUpUrl.searchParams.delete("code");
|
|
@@ -32758,6 +33055,11 @@ var PodOS = (() => {
|
|
|
32758
33055
|
cleanedUpUrl.searchParams.delete("error_description");
|
|
32759
33056
|
cleanedUpUrl.searchParams.delete("iss");
|
|
32760
33057
|
window.history.replaceState(null, "", cleanedUpUrl.toString());
|
|
33058
|
+
while (window.location.href !== cleanedUpUrl.href) {
|
|
33059
|
+
await new Promise((resolve) => {
|
|
33060
|
+
setTimeout(() => resolve(), 1);
|
|
33061
|
+
});
|
|
33062
|
+
}
|
|
32761
33063
|
}
|
|
32762
33064
|
};
|
|
32763
33065
|
function hasIssuer(options) {
|
|
@@ -32790,7 +33092,13 @@ var PodOS = (() => {
|
|
|
32790
33092
|
const issuerConfig = await this.issuerConfigFetcher.fetchConfig(options.oidcIssuer);
|
|
32791
33093
|
const clientRegistration = await handleRegistration(options, issuerConfig, this.storageUtility, this.clientRegistrar);
|
|
32792
33094
|
const OidcOptions = {
|
|
33095
|
+
// Note that here, the issuer is not the one from the received options, but
|
|
33096
|
+
// from the issuer's config. This enforces the canonical URL is used and stored,
|
|
33097
|
+
// which is also the one present in the ID token, so storing a technically
|
|
33098
|
+
// valid, but different issuer URL (e.g. using a trailing slash or not) now
|
|
33099
|
+
// could prevent from validating the ID token later.
|
|
32793
33100
|
issuer: issuerConfig.issuer,
|
|
33101
|
+
// TODO: differentiate if DPoP should be true
|
|
32794
33102
|
dpop: options.tokenType.toLowerCase() === "dpop",
|
|
32795
33103
|
...options,
|
|
32796
33104
|
issuerConfiguration: issuerConfig,
|
|
@@ -32811,6 +33119,9 @@ var PodOS = (() => {
|
|
|
32811
33119
|
response_type: "code",
|
|
32812
33120
|
scope: DEFAULT_SCOPES,
|
|
32813
33121
|
filterProtocolClaims: true,
|
|
33122
|
+
// The userinfo endpoint on NSS fails, so disable this for now
|
|
33123
|
+
// Note that in Solid, information should be retrieved from the
|
|
33124
|
+
// profile referenced by the WebId.
|
|
32814
33125
|
loadUserInfo: false,
|
|
32815
33126
|
code_verifier: true,
|
|
32816
33127
|
prompt: (_a = oidcLoginOptions.prompt) !== null && _a !== void 0 ? _a : "consent"
|
|
@@ -32820,7 +33131,9 @@ var PodOS = (() => {
|
|
|
32820
33131
|
const signingRequest = await oidcClientLibrary.createSigninRequest();
|
|
32821
33132
|
return await this.handleRedirect({
|
|
32822
33133
|
oidcLoginOptions,
|
|
33134
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
32823
33135
|
state: signingRequest.state._id,
|
|
33136
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
32824
33137
|
codeVerifier: signingRequest.state._code_verifier,
|
|
32825
33138
|
targetUrl: signingRequest.url.toString()
|
|
32826
33139
|
});
|
|
@@ -32935,12 +33248,19 @@ var PodOS = (() => {
|
|
|
32935
33248
|
this.storageUtility = storageUtility;
|
|
32936
33249
|
this.storageUtility = storageUtility;
|
|
32937
33250
|
}
|
|
33251
|
+
// This method needs no state (so can be static), and can be exposed to allow
|
|
33252
|
+
// callers to know where this implementation puts state it needs.
|
|
32938
33253
|
static getLocalStorageKey(issuer2) {
|
|
32939
33254
|
return `issuerConfig:${issuer2}`;
|
|
32940
33255
|
}
|
|
32941
33256
|
async fetchConfig(issuer2) {
|
|
32942
33257
|
let issuerConfig;
|
|
32943
|
-
const openIdConfigUrl = new URL(
|
|
33258
|
+
const openIdConfigUrl = new URL(
|
|
33259
|
+
WELL_KNOWN_OPENID_CONFIG,
|
|
33260
|
+
// Make sure to append a slash at issuer URL, so that the .well-known URL
|
|
33261
|
+
// includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.
|
|
33262
|
+
issuer2.endsWith("/") ? issuer2 : `${issuer2}/`
|
|
33263
|
+
).href;
|
|
32944
33264
|
const issuerConfigRequestBody = await fetch2.call(globalThis, openIdConfigUrl);
|
|
32945
33265
|
try {
|
|
32946
33266
|
issuerConfig = processConfig(await issuerConfigRequestBody.json());
|
|
@@ -33005,9 +33325,16 @@ var PodOS = (() => {
|
|
|
33005
33325
|
issuer: issuer2,
|
|
33006
33326
|
clientAppId: clientId,
|
|
33007
33327
|
clientAppSecret: clientSecret,
|
|
33328
|
+
// Default the token type to DPoP if unspecified.
|
|
33008
33329
|
tokenType: tokenType !== null && tokenType !== void 0 ? tokenType : "DPoP"
|
|
33009
33330
|
};
|
|
33010
33331
|
}
|
|
33332
|
+
/**
|
|
33333
|
+
* This function removes all session-related information from storage.
|
|
33334
|
+
* @param sessionId the session identifier
|
|
33335
|
+
* @param storage the storage where session info is stored
|
|
33336
|
+
* @hidden
|
|
33337
|
+
*/
|
|
33011
33338
|
async clear(sessionId) {
|
|
33012
33339
|
return clear2(sessionId, this.storageUtility);
|
|
33013
33340
|
}
|
|
@@ -33073,6 +33400,8 @@ var PodOS = (() => {
|
|
|
33073
33400
|
if (isDpop) {
|
|
33074
33401
|
tokens = await getDpopToken(issuerConfig, client, {
|
|
33075
33402
|
grantType: "authorization_code",
|
|
33403
|
+
// We rely on our 'canHandle' function checking that the OAuth 'code'
|
|
33404
|
+
// parameter is present in our query string.
|
|
33076
33405
|
code: url7.searchParams.get("code"),
|
|
33077
33406
|
codeVerifier,
|
|
33078
33407
|
redirectUrl: storedRedirectIri
|
|
@@ -33149,13 +33478,21 @@ var PodOS = (() => {
|
|
|
33149
33478
|
this.storageUtility = storageUtility;
|
|
33150
33479
|
}
|
|
33151
33480
|
async getClient(options, issuerConfig) {
|
|
33152
|
-
const [
|
|
33481
|
+
const [
|
|
33482
|
+
storedClientId,
|
|
33483
|
+
storedClientSecret
|
|
33484
|
+
// storedClientName,
|
|
33485
|
+
] = await Promise.all([
|
|
33153
33486
|
this.storageUtility.getForUser(options.sessionId, "clientId", {
|
|
33154
33487
|
secure: false
|
|
33155
33488
|
}),
|
|
33156
33489
|
this.storageUtility.getForUser(options.sessionId, "clientSecret", {
|
|
33157
33490
|
secure: false
|
|
33158
33491
|
})
|
|
33492
|
+
// this.storageUtility.getForUser(options.sessionId, "clientName", {
|
|
33493
|
+
// // FIXME: figure out how to persist secure storage at reload
|
|
33494
|
+
// secure: false,
|
|
33495
|
+
// }),
|
|
33159
33496
|
]);
|
|
33160
33497
|
if (storedClientId) {
|
|
33161
33498
|
return {
|
|
@@ -33176,6 +33513,9 @@ var PodOS = (() => {
|
|
|
33176
33513
|
infoToSave.idTokenSignedResponseAlg = registeredClient.idTokenSignedResponseAlg;
|
|
33177
33514
|
}
|
|
33178
33515
|
await this.storageUtility.setForUser(options.sessionId, infoToSave, {
|
|
33516
|
+
// FIXME: figure out how to persist secure storage at reload
|
|
33517
|
+
// Otherwise, the client info cannot be retrieved from storage, and
|
|
33518
|
+
// the lib tries to re-register the client on each fetch
|
|
33179
33519
|
secure: false
|
|
33180
33520
|
});
|
|
33181
33521
|
return registeredClient;
|
|
@@ -33244,6 +33584,8 @@ var PodOS = (() => {
|
|
|
33244
33584
|
const redirectHandler = new AggregateRedirectHandler([
|
|
33245
33585
|
new ErrorOidcHandler(),
|
|
33246
33586
|
new AuthCodeRedirectHandler(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokenRefresher),
|
|
33587
|
+
// This catch-all class will always be able to handle the
|
|
33588
|
+
// redirect IRI, so it must be registered last.
|
|
33247
33589
|
new FallbackRedirectHandler()
|
|
33248
33590
|
]);
|
|
33249
33591
|
return new ClientAuthentication2(loginHandler, redirectHandler, new IWaterfallLogoutHandler(sessionInfoManager, redirector), sessionInfoManager, issuerConfigFetcher);
|
|
@@ -33272,6 +33614,21 @@ var PodOS = (() => {
|
|
|
33272
33614
|
return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
|
|
33273
33615
|
}
|
|
33274
33616
|
var Session = class _Session extends import_events2.default {
|
|
33617
|
+
/**
|
|
33618
|
+
* Session object constructor. Typically called as follows:
|
|
33619
|
+
*
|
|
33620
|
+
* ```typescript
|
|
33621
|
+
* const session = new Session();
|
|
33622
|
+
* ```
|
|
33623
|
+
*
|
|
33624
|
+
* See also [getDefaultSession](https://docs.inrupt.com/developer-tools/api/javascript/solid-client-authn-browser/functions.html#getdefaultsession).
|
|
33625
|
+
*
|
|
33626
|
+
* @param sessionOptions The options enabling the correct instantiation of
|
|
33627
|
+
* the session. Either both storages or clientAuthentication are required. For
|
|
33628
|
+
* more information, see {@link ISessionOptions}.
|
|
33629
|
+
* @param sessionId A string uniquely identifying the session.
|
|
33630
|
+
*
|
|
33631
|
+
*/
|
|
33275
33632
|
constructor(sessionOptions = {}, sessionId = void 0) {
|
|
33276
33633
|
super();
|
|
33277
33634
|
this.tokenRequestInProgress = false;
|
|
@@ -33280,6 +33637,7 @@ var PodOS = (() => {
|
|
|
33280
33637
|
await this.clientAuthentication.login({
|
|
33281
33638
|
sessionId: this.info.sessionId,
|
|
33282
33639
|
...options,
|
|
33640
|
+
// Defaults the token type to DPoP
|
|
33283
33641
|
tokenType: (_a = options.tokenType) !== null && _a !== void 0 ? _a : "DPoP"
|
|
33284
33642
|
}, this.events);
|
|
33285
33643
|
return new Promise(() => {
|
|
@@ -33356,18 +33714,55 @@ var PodOS = (() => {
|
|
|
33356
33714
|
this.events.on(EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
|
|
33357
33715
|
this.events.on(EVENTS.ERROR, () => this.internalLogout(false));
|
|
33358
33716
|
}
|
|
33717
|
+
/**
|
|
33718
|
+
* Register a callback function to be called when a user completes login.
|
|
33719
|
+
*
|
|
33720
|
+
* The callback is called when {@link handleIncomingRedirect} completes successfully.
|
|
33721
|
+
*
|
|
33722
|
+
* @param callback The function called when a user completes login.
|
|
33723
|
+
* @deprecated Prefer session.events.on(EVENTS.LOGIN, callback)
|
|
33724
|
+
*/
|
|
33359
33725
|
onLogin(callback) {
|
|
33360
33726
|
this.events.on(EVENTS.LOGIN, callback);
|
|
33361
33727
|
}
|
|
33728
|
+
/**
|
|
33729
|
+
* Register a callback function to be called when a user logs out:
|
|
33730
|
+
*
|
|
33731
|
+
* @param callback The function called when a user completes logout.
|
|
33732
|
+
* @deprecated Prefer session.events.on(EVENTS.LOGOUT, callback)
|
|
33733
|
+
*/
|
|
33362
33734
|
onLogout(callback) {
|
|
33363
33735
|
this.events.on(EVENTS.LOGOUT, callback);
|
|
33364
33736
|
}
|
|
33737
|
+
/**
|
|
33738
|
+
* Register a callback function to be called when a user logs out:
|
|
33739
|
+
*
|
|
33740
|
+
* @param callback The function called when an error occurs.
|
|
33741
|
+
* @since 1.11.0
|
|
33742
|
+
* @deprecated Prefer session.events.on(EVENTS.ERROR, callback)
|
|
33743
|
+
*/
|
|
33365
33744
|
onError(callback) {
|
|
33366
33745
|
this.events.on(EVENTS.ERROR, callback);
|
|
33367
33746
|
}
|
|
33747
|
+
/**
|
|
33748
|
+
* Register a callback function to be called when a session is restored.
|
|
33749
|
+
*
|
|
33750
|
+
* Note: the callback will be called with the saved value of the 'current URL'
|
|
33751
|
+
* at the time the session was restored.
|
|
33752
|
+
*
|
|
33753
|
+
* @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.
|
|
33754
|
+
* @deprecated Prefer session.events.on(EVENTS.SESSION_RESTORED, callback)
|
|
33755
|
+
*/
|
|
33368
33756
|
onSessionRestore(callback) {
|
|
33369
33757
|
this.events.on(EVENTS.SESSION_RESTORED, callback);
|
|
33370
33758
|
}
|
|
33759
|
+
/**
|
|
33760
|
+
* Register a callback that runs when the session expires and can no longer
|
|
33761
|
+
* make authenticated requests, but following a user logout.
|
|
33762
|
+
* @param callback The function that runs on session expiration.
|
|
33763
|
+
* @since 1.11.0
|
|
33764
|
+
* @deprecated Prefer session.events.on(EVENTS.SESSION_EXPIRED, callback)
|
|
33765
|
+
*/
|
|
33371
33766
|
onSessionExpiration(callback) {
|
|
33372
33767
|
this.events.on(EVENTS.SESSION_EXPIRED, callback);
|
|
33373
33768
|
}
|