@lanaqi/rsr 0.0.2 → 0.0.3
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/README.md +46 -28
- package/dist/access/blocker.d.ts +3 -3
- package/dist/access/resource.d.ts +5 -5
- package/dist/access/storer.d.ts +3 -3
- package/dist/bridge.d.ts +2 -2
- package/dist/index.js +815 -374
- package/dist/security/blocker.d.ts +5 -10
- package/dist/security/context.d.ts +9 -0
- package/dist/security/index.d.ts +4 -0
- package/dist/security/provider.d.ts +8 -14
- package/dist/warpper/permission.d.ts +5 -9
- package/package.json +19 -15
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { matchPath, useBlocker, useLocation, useNavigate } from "react-router
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { matchPath, useBlocker, useLocation, useNavigate } from "react-router";
|
|
2
|
+
import { createContext, use, useEffect, useState } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
let common_AccessDecision = /*#__PURE__*/ function(AccessDecision) {
|
|
5
6
|
AccessDecision["notResource"] = "notResource";
|
|
6
7
|
AccessDecision["notAuthentication"] = "notAuthentication";
|
|
7
8
|
AccessDecision["invalidAuthentication"] = "invalidAuthentication";
|
|
@@ -11,7 +12,7 @@ var common_AccessDecision = /*#__PURE__*/ function(AccessDecision) {
|
|
|
11
12
|
AccessDecision["allowAccess"] = "allowAccess";
|
|
12
13
|
return AccessDecision;
|
|
13
14
|
}({});
|
|
14
|
-
|
|
15
|
+
let common_AccessBehave = /*#__PURE__*/ function(AccessBehave) {
|
|
15
16
|
AccessBehave["doNothing"] = "doNothing";
|
|
16
17
|
AccessBehave["goNavigate"] = "goNavigate";
|
|
17
18
|
AccessBehave["reDecision"] = "reDecision";
|
|
@@ -79,11 +80,11 @@ class SimpleUser {
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
class SimpleResource {
|
|
82
|
-
static PERMISSION_ANONYMOUS = '
|
|
83
|
-
static PERMISSION_AUTHENTICATED = '
|
|
84
|
-
static PERMISSION_AUTHORIZED = '
|
|
85
|
-
static LABEL_SIGNATURED = '
|
|
86
|
-
static LABEL_ALWAYS_SIGNATURE = '
|
|
83
|
+
static PERMISSION_ANONYMOUS = '__aqi_rsr_anonymous';
|
|
84
|
+
static PERMISSION_AUTHENTICATED = '__aqi_rsr_authenticated';
|
|
85
|
+
static PERMISSION_AUTHORIZED = '__aqi_rsr_authorized';
|
|
86
|
+
static LABEL_SIGNATURED = '__aqi_rsr_signatured';
|
|
87
|
+
static LABEL_ALWAYS_SIGNATURE = '__aqi_rsr_always_signature';
|
|
87
88
|
patterns;
|
|
88
89
|
permissions;
|
|
89
90
|
labels;
|
|
@@ -410,9 +411,9 @@ class HierarchyVoter extends CacheVoter {
|
|
|
410
411
|
}
|
|
411
412
|
}
|
|
412
413
|
class SimpleStorer {
|
|
413
|
-
static KEY_AUTHENTICATION = '
|
|
414
|
-
static KEY_AUTHORIZATION = '
|
|
415
|
-
static KEY_SIGNATURE = '
|
|
414
|
+
static KEY_AUTHENTICATION = '__aqi_rsr_authentication';
|
|
415
|
+
static KEY_AUTHORIZATION = '__aqi_rsr_authorization';
|
|
416
|
+
static KEY_SIGNATURE = '__aqi_rsr_signature';
|
|
416
417
|
aaaStorage;
|
|
417
418
|
signStorage;
|
|
418
419
|
authenticationKey;
|
|
@@ -725,7 +726,7 @@ class MultiBlocker {
|
|
|
725
726
|
this.handlers.add(handler);
|
|
726
727
|
}
|
|
727
728
|
unregister(handler) {
|
|
728
|
-
this.handlers.delete(handler);
|
|
729
|
+
if (handler) this.handlers.delete(handler);
|
|
729
730
|
}
|
|
730
731
|
clear() {
|
|
731
732
|
this.handlers.clear();
|
|
@@ -800,7 +801,7 @@ class SimpleGuarder {
|
|
|
800
801
|
recorder.setAllowPath(blockPath);
|
|
801
802
|
return common_AccessDecision.allowAccess;
|
|
802
803
|
}
|
|
803
|
-
if (authentication
|
|
804
|
+
if (authentication?.isAuthenticated()) recorder.clearOriginPath();
|
|
804
805
|
else {
|
|
805
806
|
recorder.setOriginPath(blockPath);
|
|
806
807
|
return common_AccessDecision.notAuthentication;
|
|
@@ -1301,27 +1302,15 @@ class AccessGuarderBuilder {
|
|
|
1301
1302
|
}
|
|
1302
1303
|
const SecurityContext = /*#__PURE__*/ createContext(null);
|
|
1303
1304
|
const useSecurityContext = ()=>{
|
|
1304
|
-
const sc =
|
|
1305
|
+
const sc = use(SecurityContext);
|
|
1305
1306
|
if (!sc) throw new Error('安全上下文为空,必须使用安全提供者包裹组件来设置安全上下文');
|
|
1306
1307
|
return sc;
|
|
1307
1308
|
};
|
|
1308
|
-
function
|
|
1309
|
-
const
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
]);
|
|
1314
|
-
return /*#__PURE__*/ jsx(SecurityContext.Provider, {
|
|
1315
|
-
value: provide,
|
|
1316
|
-
children: children
|
|
1317
|
-
});
|
|
1318
|
-
}
|
|
1319
|
-
function SecurityBlocker({ children }) {
|
|
1320
|
-
const { context, manager, guarder } = useSecurityContext();
|
|
1321
|
-
if (manager.isDisabled()) return /*#__PURE__*/ jsx(Fragment, {
|
|
1322
|
-
children: children
|
|
1323
|
-
});
|
|
1324
|
-
const blocker = useBlocker(({ currentLocation, nextLocation })=>currentLocation.pathname !== nextLocation.pathname);
|
|
1309
|
+
function SecurityBlocker(t0) {
|
|
1310
|
+
const $ = c(14);
|
|
1311
|
+
const { children } = t0;
|
|
1312
|
+
const { context, guarder } = useSecurityContext();
|
|
1313
|
+
const blocker = useBlocker(_temp);
|
|
1325
1314
|
const [guarded, setGuarded] = useState(false);
|
|
1326
1315
|
const [nextPath, setNextPath] = useState(useLocation());
|
|
1327
1316
|
const [firstAccess, setFirstAccess] = useState(true);
|
|
@@ -1332,405 +1321,857 @@ function SecurityBlocker({ children }) {
|
|
|
1332
1321
|
const [currentDecision, setCurrentDecision] = useState(void 0);
|
|
1333
1322
|
const [securityBlock, setSecurityBlock] = useState(false);
|
|
1334
1323
|
const [executableBlocked, setExecutableBlocked] = useState(true);
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
setHandledDecision(true);
|
|
1351
|
-
setCurrentDecision(blockedDecision);
|
|
1352
|
-
isProceed = blockedDecision === common_AccessDecision.allowAccess;
|
|
1353
|
-
}
|
|
1354
|
-
setNextPath(blockPath);
|
|
1355
|
-
setExecutableBlocked(false);
|
|
1356
|
-
if (isProceed) {
|
|
1357
|
-
const isDiff = !!stayPath && stayPath.pathname !== blockPath.pathname;
|
|
1358
|
-
if (isDiff) guarder.permitBefore(stayPath, blockPath);
|
|
1359
|
-
blocker.proceed();
|
|
1360
|
-
if (isDiff) guarder.permitAfter(stayPath, blockPath);
|
|
1361
|
-
} else blocker.reset();
|
|
1362
|
-
} else if ('unblocked' === blocker.state) {
|
|
1363
|
-
if (handledDecision && currentDecision) {
|
|
1364
|
-
let navNext;
|
|
1365
|
-
const behave = guarder.guardHandle(currentDecision, beforeDecision);
|
|
1366
|
-
switch(behave){
|
|
1367
|
-
case common_AccessBehave.reDecision:
|
|
1368
|
-
setBeforeDecision(currentDecision);
|
|
1369
|
-
setSecurityBlock(false);
|
|
1370
|
-
navNext = true;
|
|
1371
|
-
break;
|
|
1372
|
-
case common_AccessBehave.goNavigate:
|
|
1373
|
-
setBeforeDecision(void 0);
|
|
1374
|
-
navNext = false;
|
|
1375
|
-
setSecurityBlock(false);
|
|
1376
|
-
break;
|
|
1377
|
-
case common_AccessBehave.doNothing:
|
|
1378
|
-
default:
|
|
1379
|
-
setBeforeDecision(void 0);
|
|
1380
|
-
navNext = false;
|
|
1381
|
-
setSecurityBlock(true);
|
|
1382
|
-
break;
|
|
1383
|
-
}
|
|
1384
|
-
if (firstHandle && currentDecision === common_AccessDecision.notSignature && behave === common_AccessBehave.reDecision) if (countSignature >= 3) {
|
|
1385
|
-
setFirstHandle(false);
|
|
1386
|
-
setBeforeDecision(common_AccessDecision.notSignature);
|
|
1387
|
-
setHandledDecision(true);
|
|
1388
|
-
setCurrentDecision(common_AccessDecision.accessDenied);
|
|
1324
|
+
let t1;
|
|
1325
|
+
let t2;
|
|
1326
|
+
if ($[0] !== beforeDecision || $[1] !== blocker || $[2] !== context || $[3] !== countSignature || $[4] !== currentDecision || $[5] !== executableBlocked || $[6] !== firstAccess || $[7] !== firstHandle || $[8] !== guarder || $[9] !== handledDecision || $[10] !== nextPath || $[11] !== securityBlock) {
|
|
1327
|
+
t1 = ()=>{
|
|
1328
|
+
if ("blocked" === blocker.state && executableBlocked) {
|
|
1329
|
+
let isProceed;
|
|
1330
|
+
const recorder = context.getRecorder();
|
|
1331
|
+
const stayPath = recorder.getAllowPath();
|
|
1332
|
+
const blockPath = blocker.location;
|
|
1333
|
+
let guardBlocked = false;
|
|
1334
|
+
if (securityBlock) guardBlocked = guarder.guardBlock(blockPath);
|
|
1335
|
+
if (guardBlocked) {
|
|
1336
|
+
setHandledDecision(false);
|
|
1337
|
+
setCurrentDecision(void 0);
|
|
1338
|
+
isProceed = false;
|
|
1389
1339
|
} else {
|
|
1390
|
-
|
|
1340
|
+
if (!beforeDecision) guarder.guardBefore(blockPath);
|
|
1341
|
+
const blockedDecision = guarder.guardDecision(blockPath);
|
|
1391
1342
|
setHandledDecision(true);
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
setCountSignature(countSignature + 1);
|
|
1343
|
+
setCurrentDecision(blockedDecision);
|
|
1344
|
+
isProceed = blockedDecision === common_AccessDecision.allowAccess;
|
|
1395
1345
|
}
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
if (
|
|
1346
|
+
setNextPath(blockPath);
|
|
1347
|
+
setExecutableBlocked(false);
|
|
1348
|
+
if (isProceed) {
|
|
1349
|
+
const isDiff = !!stayPath && stayPath.pathname !== blockPath.pathname;
|
|
1350
|
+
if (isDiff) guarder.permitBefore(stayPath, blockPath);
|
|
1351
|
+
blocker.proceed();
|
|
1352
|
+
if (isDiff) guarder.permitAfter(stayPath, blockPath);
|
|
1353
|
+
} else blocker.reset();
|
|
1354
|
+
} else if ("unblocked" === blocker.state) {
|
|
1355
|
+
if (handledDecision && currentDecision) {
|
|
1356
|
+
let navNext;
|
|
1357
|
+
const behave = guarder.guardHandle(currentDecision, beforeDecision);
|
|
1358
|
+
switch(behave){
|
|
1359
|
+
case common_AccessBehave.reDecision:
|
|
1360
|
+
setBeforeDecision(currentDecision);
|
|
1361
|
+
setSecurityBlock(false);
|
|
1362
|
+
navNext = true;
|
|
1363
|
+
break;
|
|
1364
|
+
case common_AccessBehave.goNavigate:
|
|
1365
|
+
setBeforeDecision(void 0);
|
|
1366
|
+
navNext = false;
|
|
1367
|
+
setSecurityBlock(false);
|
|
1368
|
+
break;
|
|
1369
|
+
case common_AccessBehave.doNothing:
|
|
1370
|
+
default:
|
|
1371
|
+
setBeforeDecision(void 0);
|
|
1372
|
+
navNext = false;
|
|
1373
|
+
setSecurityBlock(true);
|
|
1374
|
+
}
|
|
1375
|
+
if (firstHandle && currentDecision === common_AccessDecision.notSignature && behave === common_AccessBehave.reDecision) if (countSignature >= 3) {
|
|
1376
|
+
setFirstHandle(false);
|
|
1377
|
+
setBeforeDecision(common_AccessDecision.notSignature);
|
|
1378
|
+
setHandledDecision(true);
|
|
1379
|
+
setCurrentDecision(common_AccessDecision.accessDenied);
|
|
1380
|
+
} else {
|
|
1381
|
+
const signDecision = guarder.guardDecision(nextPath);
|
|
1382
|
+
setHandledDecision(true);
|
|
1383
|
+
setBeforeDecision(void 0);
|
|
1384
|
+
setCurrentDecision(signDecision);
|
|
1385
|
+
setCountSignature(countSignature + 1);
|
|
1386
|
+
}
|
|
1401
1387
|
else {
|
|
1402
|
-
|
|
1403
|
-
|
|
1388
|
+
setFirstHandle(false);
|
|
1389
|
+
setHandledDecision(false);
|
|
1390
|
+
setCurrentDecision(void 0);
|
|
1391
|
+
if (navNext) context.getNavigator().navigate(nextPath);
|
|
1392
|
+
else {
|
|
1393
|
+
guarder.guardAfter(nextPath, currentDecision);
|
|
1394
|
+
setGuarded(true);
|
|
1395
|
+
}
|
|
1404
1396
|
}
|
|
1397
|
+
} else if (firstAccess) {
|
|
1398
|
+
guarder.guardBefore(nextPath);
|
|
1399
|
+
const firstDecision = guarder.guardDecision(nextPath);
|
|
1400
|
+
setFirstAccess(false);
|
|
1401
|
+
setHandledDecision(true);
|
|
1402
|
+
setCurrentDecision(firstDecision);
|
|
1405
1403
|
}
|
|
1406
|
-
|
|
1407
|
-
guarder.guardBefore(nextPath);
|
|
1408
|
-
const firstDecision = guarder.guardDecision(nextPath);
|
|
1409
|
-
setFirstAccess(false);
|
|
1410
|
-
setHandledDecision(true);
|
|
1411
|
-
setCurrentDecision(firstDecision);
|
|
1404
|
+
if (!executableBlocked) setExecutableBlocked(true);
|
|
1412
1405
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1406
|
+
};
|
|
1407
|
+
t2 = [
|
|
1408
|
+
blocker,
|
|
1409
|
+
context,
|
|
1410
|
+
guarder,
|
|
1411
|
+
nextPath,
|
|
1412
|
+
firstAccess,
|
|
1413
|
+
firstHandle,
|
|
1414
|
+
countSignature,
|
|
1415
|
+
handledDecision,
|
|
1416
|
+
beforeDecision,
|
|
1417
|
+
currentDecision,
|
|
1418
|
+
securityBlock,
|
|
1419
|
+
executableBlocked
|
|
1420
|
+
];
|
|
1421
|
+
$[0] = beforeDecision;
|
|
1422
|
+
$[1] = blocker;
|
|
1423
|
+
$[2] = context;
|
|
1424
|
+
$[3] = countSignature;
|
|
1425
|
+
$[4] = currentDecision;
|
|
1426
|
+
$[5] = executableBlocked;
|
|
1427
|
+
$[6] = firstAccess;
|
|
1428
|
+
$[7] = firstHandle;
|
|
1429
|
+
$[8] = guarder;
|
|
1430
|
+
$[9] = handledDecision;
|
|
1431
|
+
$[10] = nextPath;
|
|
1432
|
+
$[11] = securityBlock;
|
|
1433
|
+
$[12] = t1;
|
|
1434
|
+
$[13] = t2;
|
|
1435
|
+
} else {
|
|
1436
|
+
t1 = $[12];
|
|
1437
|
+
t2 = $[13];
|
|
1438
|
+
}
|
|
1439
|
+
useEffect(t1, t2);
|
|
1440
|
+
if (!guarded) return null;
|
|
1441
|
+
return children;
|
|
1442
|
+
}
|
|
1443
|
+
function _temp(t0) {
|
|
1444
|
+
const { currentLocation, nextLocation } = t0;
|
|
1445
|
+
return currentLocation.pathname !== nextLocation.pathname;
|
|
1446
|
+
}
|
|
1447
|
+
function SecurityProvider(t0) {
|
|
1448
|
+
const $ = c(8);
|
|
1449
|
+
const { children, bundler } = t0;
|
|
1450
|
+
const navigate = useNavigate();
|
|
1451
|
+
let t1;
|
|
1452
|
+
if ($[0] !== bundler || $[1] !== navigate) {
|
|
1453
|
+
t1 = bundler(new AccessGuarderBuilder().navigate(navigate));
|
|
1454
|
+
$[0] = bundler;
|
|
1455
|
+
$[1] = navigate;
|
|
1456
|
+
$[2] = t1;
|
|
1457
|
+
} else t1 = $[2];
|
|
1458
|
+
const provide = t1;
|
|
1459
|
+
if (provide.manager.isDisabled()) return children;
|
|
1460
|
+
let t2;
|
|
1461
|
+
if ($[3] !== children) {
|
|
1462
|
+
t2 = /*#__PURE__*/ jsx(SecurityBlocker, {
|
|
1463
|
+
children: children
|
|
1464
|
+
});
|
|
1465
|
+
$[3] = children;
|
|
1466
|
+
$[4] = t2;
|
|
1467
|
+
} else t2 = $[4];
|
|
1468
|
+
let t3;
|
|
1469
|
+
if ($[5] !== provide || $[6] !== t2) {
|
|
1470
|
+
t3 = /*#__PURE__*/ jsx(SecurityContext, {
|
|
1471
|
+
value: provide,
|
|
1472
|
+
children: t2
|
|
1473
|
+
});
|
|
1474
|
+
$[5] = provide;
|
|
1475
|
+
$[6] = t2;
|
|
1476
|
+
$[7] = t3;
|
|
1477
|
+
} else t3 = $[7];
|
|
1478
|
+
return t3;
|
|
1433
1479
|
}
|
|
1434
1480
|
const withSecurityBlocker = (Component, bundler)=>()=>/*#__PURE__*/ jsx(SecurityProvider, {
|
|
1435
1481
|
bundler: bundler,
|
|
1436
|
-
children: /*#__PURE__*/ jsx(
|
|
1437
|
-
children: /*#__PURE__*/ jsx(Component, {})
|
|
1438
|
-
})
|
|
1482
|
+
children: /*#__PURE__*/ jsx(Component, {})
|
|
1439
1483
|
});
|
|
1440
1484
|
const useObtainAuthentication = ()=>{
|
|
1485
|
+
const $ = c(7);
|
|
1441
1486
|
const { context } = useSecurityContext();
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1487
|
+
let t0;
|
|
1488
|
+
if ($[0] !== context) {
|
|
1489
|
+
t0 = context.getStorer();
|
|
1490
|
+
$[0] = context;
|
|
1491
|
+
$[1] = t0;
|
|
1492
|
+
} else t0 = $[1];
|
|
1493
|
+
const storer = t0;
|
|
1494
|
+
let t1;
|
|
1495
|
+
if ($[2] !== context) {
|
|
1496
|
+
t1 = context.getRecorder();
|
|
1497
|
+
$[2] = context;
|
|
1498
|
+
$[3] = t1;
|
|
1499
|
+
} else t1 = $[3];
|
|
1500
|
+
const recorder = t1;
|
|
1501
|
+
let t2;
|
|
1502
|
+
if ($[4] !== recorder || $[5] !== storer) {
|
|
1503
|
+
t2 = ()=>{
|
|
1504
|
+
let authentication = recorder.getAccessAuthentication();
|
|
1505
|
+
if (!authentication) {
|
|
1506
|
+
authentication = storer.loadAuthentication(recorder);
|
|
1507
|
+
if (authentication) recorder.setAccessAuthentication(authentication);
|
|
1508
|
+
}
|
|
1509
|
+
return authentication;
|
|
1510
|
+
};
|
|
1511
|
+
$[4] = recorder;
|
|
1512
|
+
$[5] = storer;
|
|
1513
|
+
$[6] = t2;
|
|
1514
|
+
} else t2 = $[6];
|
|
1515
|
+
return t2;
|
|
1452
1516
|
};
|
|
1453
1517
|
const useObtainAuthorization = ()=>{
|
|
1518
|
+
const $ = c(8);
|
|
1454
1519
|
const obtainAuthentication = useObtainAuthentication();
|
|
1455
1520
|
const { context } = useSecurityContext();
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1521
|
+
let t0;
|
|
1522
|
+
if ($[0] !== context) {
|
|
1523
|
+
t0 = context.getStorer();
|
|
1524
|
+
$[0] = context;
|
|
1525
|
+
$[1] = t0;
|
|
1526
|
+
} else t0 = $[1];
|
|
1527
|
+
const storer = t0;
|
|
1528
|
+
let t1;
|
|
1529
|
+
if ($[2] !== context) {
|
|
1530
|
+
t1 = context.getRecorder();
|
|
1531
|
+
$[2] = context;
|
|
1532
|
+
$[3] = t1;
|
|
1533
|
+
} else t1 = $[3];
|
|
1534
|
+
const recorder = t1;
|
|
1535
|
+
let t2;
|
|
1536
|
+
if ($[4] !== obtainAuthentication || $[5] !== recorder || $[6] !== storer) {
|
|
1537
|
+
t2 = ()=>{
|
|
1538
|
+
let authorization = recorder.getAccessAuthorization();
|
|
1539
|
+
if (!authorization) {
|
|
1540
|
+
const authentication = obtainAuthentication();
|
|
1541
|
+
authorization = storer.loadAuthorization(recorder, authentication);
|
|
1542
|
+
if (authorization) recorder.setAccessAuthorization(authorization);
|
|
1543
|
+
}
|
|
1544
|
+
return authorization;
|
|
1545
|
+
};
|
|
1546
|
+
$[4] = obtainAuthentication;
|
|
1547
|
+
$[5] = recorder;
|
|
1548
|
+
$[6] = storer;
|
|
1549
|
+
$[7] = t2;
|
|
1550
|
+
} else t2 = $[7];
|
|
1551
|
+
return t2;
|
|
1467
1552
|
};
|
|
1468
1553
|
const useDeleteAuthentication = ()=>{
|
|
1554
|
+
const $ = c(8);
|
|
1469
1555
|
const { context } = useSecurityContext();
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1556
|
+
let t0;
|
|
1557
|
+
if ($[0] !== context) {
|
|
1558
|
+
t0 = context.getStorer();
|
|
1559
|
+
$[0] = context;
|
|
1560
|
+
$[1] = t0;
|
|
1561
|
+
} else t0 = $[1];
|
|
1562
|
+
const storer = t0;
|
|
1563
|
+
let t1;
|
|
1564
|
+
if ($[2] !== context) {
|
|
1565
|
+
t1 = context.getRecorder();
|
|
1566
|
+
$[2] = context;
|
|
1567
|
+
$[3] = t1;
|
|
1568
|
+
} else t1 = $[3];
|
|
1569
|
+
const recorder = t1;
|
|
1570
|
+
let t2;
|
|
1571
|
+
if ($[4] !== context || $[5] !== recorder || $[6] !== storer) {
|
|
1572
|
+
t2 = ()=>{
|
|
1573
|
+
storer.deleteAuthentication(recorder);
|
|
1574
|
+
storer.deleteAuthorization(recorder);
|
|
1575
|
+
recorder.clearAccessAuthentication();
|
|
1576
|
+
recorder.clearAccessAuthorization();
|
|
1577
|
+
const parent = context.getParent();
|
|
1578
|
+
if (parent) {
|
|
1579
|
+
const p_recorder = parent.getRecorder();
|
|
1580
|
+
const p_storer = parent.getStorer();
|
|
1581
|
+
p_storer.deleteAuthentication(p_recorder);
|
|
1582
|
+
p_storer.deleteAuthorization(p_recorder);
|
|
1583
|
+
p_recorder.clearAccessAuthentication();
|
|
1584
|
+
p_recorder.clearAccessAuthorization();
|
|
1585
|
+
}
|
|
1586
|
+
};
|
|
1587
|
+
$[4] = context;
|
|
1588
|
+
$[5] = recorder;
|
|
1589
|
+
$[6] = storer;
|
|
1590
|
+
$[7] = t2;
|
|
1591
|
+
} else t2 = $[7];
|
|
1592
|
+
return t2;
|
|
1487
1593
|
};
|
|
1488
1594
|
const useDeleteAuthorization = ()=>{
|
|
1595
|
+
const $ = c(8);
|
|
1489
1596
|
const { context } = useSecurityContext();
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
};
|
|
1597
|
+
let t0;
|
|
1598
|
+
if ($[0] !== context) {
|
|
1599
|
+
t0 = context.getStorer();
|
|
1600
|
+
$[0] = context;
|
|
1601
|
+
$[1] = t0;
|
|
1602
|
+
} else t0 = $[1];
|
|
1603
|
+
const storer = t0;
|
|
1604
|
+
let t1;
|
|
1605
|
+
if ($[2] !== context) {
|
|
1606
|
+
t1 = context.getRecorder();
|
|
1607
|
+
$[2] = context;
|
|
1608
|
+
$[3] = t1;
|
|
1609
|
+
} else t1 = $[3];
|
|
1610
|
+
const recorder = t1;
|
|
1611
|
+
let t2;
|
|
1612
|
+
if ($[4] !== context || $[5] !== recorder || $[6] !== storer) {
|
|
1613
|
+
t2 = ()=>{
|
|
1614
|
+
storer.deleteAuthorization(recorder);
|
|
1615
|
+
recorder.clearAccessAuthorization();
|
|
1616
|
+
const parent = context.getParent();
|
|
1617
|
+
if (parent) {
|
|
1618
|
+
const p_recorder = parent.getRecorder();
|
|
1619
|
+
const p_storer = parent.getStorer();
|
|
1620
|
+
p_storer.deleteAuthorization(p_recorder);
|
|
1621
|
+
p_recorder.clearAccessAuthorization();
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
$[4] = context;
|
|
1625
|
+
$[5] = recorder;
|
|
1626
|
+
$[6] = storer;
|
|
1627
|
+
$[7] = t2;
|
|
1628
|
+
} else t2 = $[7];
|
|
1629
|
+
return t2;
|
|
1503
1630
|
};
|
|
1504
|
-
const useSaveAuthentication = (
|
|
1631
|
+
const useSaveAuthentication = (t0)=>{
|
|
1632
|
+
const $ = c(11);
|
|
1633
|
+
const redirect = void 0 === t0 ? "" : t0;
|
|
1505
1634
|
const { context } = useSecurityContext();
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
};
|
|
1635
|
+
let t1;
|
|
1636
|
+
if ($[0] !== context) {
|
|
1637
|
+
t1 = context.getRecorder();
|
|
1638
|
+
$[0] = context;
|
|
1639
|
+
$[1] = t1;
|
|
1640
|
+
} else t1 = $[1];
|
|
1641
|
+
const recorder = t1;
|
|
1642
|
+
let t2;
|
|
1643
|
+
if ($[2] !== context) {
|
|
1644
|
+
t2 = context.getStorer();
|
|
1645
|
+
$[2] = context;
|
|
1646
|
+
$[3] = t2;
|
|
1647
|
+
} else t2 = $[3];
|
|
1648
|
+
const storer = t2;
|
|
1649
|
+
let t3;
|
|
1650
|
+
if ($[4] !== context) {
|
|
1651
|
+
t3 = context.getNavigator();
|
|
1652
|
+
$[4] = context;
|
|
1653
|
+
$[5] = t3;
|
|
1654
|
+
} else t3 = $[5];
|
|
1655
|
+
const navigator = t3;
|
|
1656
|
+
let t4;
|
|
1657
|
+
if ($[6] !== navigator || $[7] !== recorder || $[8] !== redirect || $[9] !== storer) {
|
|
1658
|
+
t4 = (datasheet)=>{
|
|
1659
|
+
storer.saveAuthentication(recorder, datasheet);
|
|
1660
|
+
recorder.clearAccessAuthentication();
|
|
1661
|
+
recorder.clearAccessAuthorization();
|
|
1662
|
+
if ("" !== redirect) {
|
|
1663
|
+
const path = recorder.getOriginPath();
|
|
1664
|
+
if (path) navigator.navigate(path);
|
|
1665
|
+
else navigator.navigate(redirect);
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
$[6] = navigator;
|
|
1669
|
+
$[7] = recorder;
|
|
1670
|
+
$[8] = redirect;
|
|
1671
|
+
$[9] = storer;
|
|
1672
|
+
$[10] = t4;
|
|
1673
|
+
} else t4 = $[10];
|
|
1674
|
+
return t4;
|
|
1519
1675
|
};
|
|
1520
|
-
const useSaveAuthorization = (
|
|
1676
|
+
const useSaveAuthorization = (t0)=>{
|
|
1677
|
+
const $ = c(11);
|
|
1678
|
+
const redirect = void 0 === t0 ? "" : t0;
|
|
1521
1679
|
const { context } = useSecurityContext();
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1680
|
+
let t1;
|
|
1681
|
+
if ($[0] !== context) {
|
|
1682
|
+
t1 = context.getRecorder();
|
|
1683
|
+
$[0] = context;
|
|
1684
|
+
$[1] = t1;
|
|
1685
|
+
} else t1 = $[1];
|
|
1686
|
+
const recorder = t1;
|
|
1687
|
+
let t2;
|
|
1688
|
+
if ($[2] !== context) {
|
|
1689
|
+
t2 = context.getStorer();
|
|
1690
|
+
$[2] = context;
|
|
1691
|
+
$[3] = t2;
|
|
1692
|
+
} else t2 = $[3];
|
|
1693
|
+
const storer = t2;
|
|
1694
|
+
let t3;
|
|
1695
|
+
if ($[4] !== context) {
|
|
1696
|
+
t3 = context.getNavigator();
|
|
1697
|
+
$[4] = context;
|
|
1698
|
+
$[5] = t3;
|
|
1699
|
+
} else t3 = $[5];
|
|
1700
|
+
const navigator = t3;
|
|
1701
|
+
let t4;
|
|
1702
|
+
if ($[6] !== navigator || $[7] !== recorder || $[8] !== redirect || $[9] !== storer) {
|
|
1703
|
+
t4 = (datasheet)=>{
|
|
1704
|
+
storer.saveAuthorization(recorder, datasheet);
|
|
1705
|
+
recorder.clearAccessAuthorization();
|
|
1706
|
+
if ("" !== redirect) {
|
|
1707
|
+
const path = recorder.getOriginPath();
|
|
1708
|
+
if (path) navigator.navigate(path);
|
|
1709
|
+
else navigator.navigate(redirect);
|
|
1710
|
+
}
|
|
1711
|
+
};
|
|
1712
|
+
$[6] = navigator;
|
|
1713
|
+
$[7] = recorder;
|
|
1714
|
+
$[8] = redirect;
|
|
1715
|
+
$[9] = storer;
|
|
1716
|
+
$[10] = t4;
|
|
1717
|
+
} else t4 = $[10];
|
|
1718
|
+
return t4;
|
|
1534
1719
|
};
|
|
1535
1720
|
const useHavePermission = ()=>{
|
|
1721
|
+
const $ = c(5);
|
|
1536
1722
|
const obtainAuthorization = useObtainAuthorization();
|
|
1537
1723
|
const { context } = useSecurityContext();
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1724
|
+
let t0;
|
|
1725
|
+
if ($[0] !== context) {
|
|
1726
|
+
t0 = context.getVoter();
|
|
1727
|
+
$[0] = context;
|
|
1728
|
+
$[1] = t0;
|
|
1729
|
+
} else t0 = $[1];
|
|
1730
|
+
const voter = t0;
|
|
1731
|
+
let t1;
|
|
1732
|
+
if ($[2] !== obtainAuthorization || $[3] !== voter) {
|
|
1733
|
+
t1 = (term)=>{
|
|
1734
|
+
let have = false;
|
|
1735
|
+
const authorization = obtainAuthorization();
|
|
1736
|
+
if (authorization) {
|
|
1737
|
+
let permissions;
|
|
1738
|
+
permissions = Array.isArray(term) ? term : [
|
|
1739
|
+
term
|
|
1740
|
+
];
|
|
1741
|
+
have = voter.vote(new Set(permissions), authorization.getPermissions());
|
|
1742
|
+
}
|
|
1743
|
+
return have;
|
|
1744
|
+
};
|
|
1745
|
+
$[2] = obtainAuthorization;
|
|
1746
|
+
$[3] = voter;
|
|
1747
|
+
$[4] = t1;
|
|
1748
|
+
} else t1 = $[4];
|
|
1749
|
+
return t1;
|
|
1551
1750
|
};
|
|
1552
|
-
const useSaveSignature = (
|
|
1751
|
+
const useSaveSignature = (t0)=>{
|
|
1752
|
+
const $ = c(11);
|
|
1753
|
+
const redirect = void 0 === t0 ? "/" : t0;
|
|
1553
1754
|
const { context } = useSecurityContext();
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1755
|
+
let t1;
|
|
1756
|
+
if ($[0] !== context) {
|
|
1757
|
+
t1 = context.getRecorder();
|
|
1758
|
+
$[0] = context;
|
|
1759
|
+
$[1] = t1;
|
|
1760
|
+
} else t1 = $[1];
|
|
1761
|
+
const recorder = t1;
|
|
1762
|
+
let t2;
|
|
1763
|
+
if ($[2] !== context) {
|
|
1764
|
+
t2 = context.getStorer();
|
|
1765
|
+
$[2] = context;
|
|
1766
|
+
$[3] = t2;
|
|
1767
|
+
} else t2 = $[3];
|
|
1768
|
+
const storer = t2;
|
|
1769
|
+
let t3;
|
|
1770
|
+
if ($[4] !== context) {
|
|
1771
|
+
t3 = context.getNavigator();
|
|
1772
|
+
$[4] = context;
|
|
1773
|
+
$[5] = t3;
|
|
1774
|
+
} else t3 = $[5];
|
|
1775
|
+
const navigator = t3;
|
|
1776
|
+
let t4;
|
|
1777
|
+
if ($[6] !== navigator || $[7] !== recorder || $[8] !== redirect || $[9] !== storer) {
|
|
1778
|
+
t4 = (path)=>{
|
|
1779
|
+
let target;
|
|
1780
|
+
target = path ? path : recorder.getOriginPath();
|
|
1781
|
+
if (target) storer.saveSignature(recorder, target);
|
|
1782
|
+
if ("" !== redirect) if (target) navigator.navigate(target);
|
|
1783
|
+
else navigator.navigate(redirect);
|
|
1784
|
+
};
|
|
1785
|
+
$[6] = navigator;
|
|
1786
|
+
$[7] = recorder;
|
|
1787
|
+
$[8] = redirect;
|
|
1788
|
+
$[9] = storer;
|
|
1789
|
+
$[10] = t4;
|
|
1790
|
+
} else t4 = $[10];
|
|
1791
|
+
return t4;
|
|
1564
1792
|
};
|
|
1565
1793
|
const useDeleteSignature = ()=>{
|
|
1794
|
+
const $ = c(7);
|
|
1566
1795
|
const { context } = useSecurityContext();
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1796
|
+
let t0;
|
|
1797
|
+
if ($[0] !== context) {
|
|
1798
|
+
t0 = context.getRecorder();
|
|
1799
|
+
$[0] = context;
|
|
1800
|
+
$[1] = t0;
|
|
1801
|
+
} else t0 = $[1];
|
|
1802
|
+
const recorder = t0;
|
|
1803
|
+
let t1;
|
|
1804
|
+
if ($[2] !== context) {
|
|
1805
|
+
t1 = context.getStorer();
|
|
1806
|
+
$[2] = context;
|
|
1807
|
+
$[3] = t1;
|
|
1808
|
+
} else t1 = $[3];
|
|
1809
|
+
const storer = t1;
|
|
1810
|
+
let t2;
|
|
1811
|
+
if ($[4] !== recorder || $[5] !== storer) {
|
|
1812
|
+
t2 = ()=>{
|
|
1813
|
+
storer.deleteSignature(recorder);
|
|
1814
|
+
};
|
|
1815
|
+
$[4] = recorder;
|
|
1816
|
+
$[5] = storer;
|
|
1817
|
+
$[6] = t2;
|
|
1818
|
+
} else t2 = $[6];
|
|
1819
|
+
return t2;
|
|
1572
1820
|
};
|
|
1573
1821
|
const useRemoveSignature = ()=>{
|
|
1822
|
+
const $ = c(7);
|
|
1574
1823
|
const { context } = useSecurityContext();
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1824
|
+
let t0;
|
|
1825
|
+
if ($[0] !== context) {
|
|
1826
|
+
t0 = context.getRecorder();
|
|
1827
|
+
$[0] = context;
|
|
1828
|
+
$[1] = t0;
|
|
1829
|
+
} else t0 = $[1];
|
|
1830
|
+
const recorder = t0;
|
|
1831
|
+
let t1;
|
|
1832
|
+
if ($[2] !== context) {
|
|
1833
|
+
t1 = context.getStorer();
|
|
1834
|
+
$[2] = context;
|
|
1835
|
+
$[3] = t1;
|
|
1836
|
+
} else t1 = $[3];
|
|
1837
|
+
const storer = t1;
|
|
1838
|
+
let t2;
|
|
1839
|
+
if ($[4] !== recorder || $[5] !== storer) {
|
|
1840
|
+
t2 = (path)=>{
|
|
1841
|
+
if ("string" == typeof path) storer.removeSignature(recorder, {
|
|
1842
|
+
pathname: path,
|
|
1843
|
+
search: "",
|
|
1844
|
+
hash: ""
|
|
1845
|
+
});
|
|
1846
|
+
else storer.removeSignature(recorder, path);
|
|
1847
|
+
};
|
|
1848
|
+
$[4] = recorder;
|
|
1849
|
+
$[5] = storer;
|
|
1850
|
+
$[6] = t2;
|
|
1851
|
+
} else t2 = $[6];
|
|
1852
|
+
return t2;
|
|
1585
1853
|
};
|
|
1586
1854
|
const usePurgeSignature = ()=>{
|
|
1855
|
+
const $ = c(9);
|
|
1587
1856
|
const { context } = useSecurityContext();
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
recorder
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1857
|
+
let recorder;
|
|
1858
|
+
let storer;
|
|
1859
|
+
let t0;
|
|
1860
|
+
if ($[0] !== context) {
|
|
1861
|
+
recorder = context.getRecorder();
|
|
1862
|
+
storer = context.getStorer();
|
|
1863
|
+
t0 = recorder.getCurrentPath();
|
|
1864
|
+
$[0] = context;
|
|
1865
|
+
$[1] = recorder;
|
|
1866
|
+
$[2] = storer;
|
|
1867
|
+
$[3] = t0;
|
|
1868
|
+
} else {
|
|
1869
|
+
recorder = $[1];
|
|
1870
|
+
storer = $[2];
|
|
1871
|
+
t0 = $[3];
|
|
1872
|
+
}
|
|
1873
|
+
const path = t0;
|
|
1874
|
+
let t1;
|
|
1875
|
+
let t2;
|
|
1876
|
+
if ($[4] !== path || $[5] !== recorder || $[6] !== storer) {
|
|
1877
|
+
t1 = ()=>()=>{
|
|
1878
|
+
if (path) storer.removeSignature(recorder, path);
|
|
1879
|
+
};
|
|
1880
|
+
t2 = [
|
|
1881
|
+
recorder,
|
|
1882
|
+
storer,
|
|
1883
|
+
path
|
|
1884
|
+
];
|
|
1885
|
+
$[4] = path;
|
|
1886
|
+
$[5] = recorder;
|
|
1887
|
+
$[6] = storer;
|
|
1888
|
+
$[7] = t1;
|
|
1889
|
+
$[8] = t2;
|
|
1890
|
+
} else {
|
|
1891
|
+
t1 = $[7];
|
|
1892
|
+
t2 = $[8];
|
|
1893
|
+
}
|
|
1894
|
+
useEffect(t1, t2);
|
|
1598
1895
|
};
|
|
1599
|
-
const useLogout = (
|
|
1896
|
+
const useLogout = (t0, t1)=>{
|
|
1897
|
+
const $ = c(13);
|
|
1898
|
+
const cRedirect = void 0 === t0 ? "/" : t0;
|
|
1899
|
+
const pRedirect = void 0 === t1 ? "/" : t1;
|
|
1600
1900
|
const { context } = useSecurityContext();
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1901
|
+
let t2;
|
|
1902
|
+
if ($[0] !== context) {
|
|
1903
|
+
t2 = context.getRecorder();
|
|
1904
|
+
$[0] = context;
|
|
1905
|
+
$[1] = t2;
|
|
1906
|
+
} else t2 = $[1];
|
|
1907
|
+
const recorder = t2;
|
|
1908
|
+
let t3;
|
|
1909
|
+
if ($[2] !== context) {
|
|
1910
|
+
t3 = context.getStorer();
|
|
1911
|
+
$[2] = context;
|
|
1912
|
+
$[3] = t3;
|
|
1913
|
+
} else t3 = $[3];
|
|
1914
|
+
const storer = t3;
|
|
1915
|
+
let t4;
|
|
1916
|
+
if ($[4] !== context) {
|
|
1917
|
+
t4 = context.getNavigator();
|
|
1918
|
+
$[4] = context;
|
|
1919
|
+
$[5] = t4;
|
|
1920
|
+
} else t4 = $[5];
|
|
1921
|
+
const navigator = t4;
|
|
1922
|
+
let t5;
|
|
1923
|
+
if ($[6] !== cRedirect || $[7] !== context || $[8] !== navigator || $[9] !== pRedirect || $[10] !== recorder || $[11] !== storer) {
|
|
1924
|
+
t5 = ()=>{
|
|
1925
|
+
storer.deleteAuthentication(recorder);
|
|
1926
|
+
storer.deleteAuthorization(recorder);
|
|
1927
|
+
storer.deleteSignature(recorder);
|
|
1928
|
+
recorder.clearAccessAuthentication();
|
|
1929
|
+
recorder.clearAccessAuthorization();
|
|
1930
|
+
if ("" !== cRedirect) navigator.navigate(cRedirect);
|
|
1931
|
+
const parent = context.getParent();
|
|
1932
|
+
if (parent) {
|
|
1933
|
+
const p_recorder = parent.getRecorder();
|
|
1934
|
+
const p_storer = parent.getStorer();
|
|
1935
|
+
const p_navigator = parent.getNavigator();
|
|
1936
|
+
p_storer.deleteAuthentication(p_recorder);
|
|
1937
|
+
p_storer.deleteAuthorization(p_recorder);
|
|
1938
|
+
p_storer.deleteSignature(p_recorder);
|
|
1939
|
+
p_recorder.clearAccessAuthentication();
|
|
1940
|
+
p_recorder.clearAccessAuthorization();
|
|
1941
|
+
if ("" !== pRedirect) p_navigator.navigate(pRedirect);
|
|
1942
|
+
}
|
|
1943
|
+
};
|
|
1944
|
+
$[6] = cRedirect;
|
|
1945
|
+
$[7] = context;
|
|
1946
|
+
$[8] = navigator;
|
|
1947
|
+
$[9] = pRedirect;
|
|
1948
|
+
$[10] = recorder;
|
|
1949
|
+
$[11] = storer;
|
|
1950
|
+
$[12] = t5;
|
|
1951
|
+
} else t5 = $[12];
|
|
1952
|
+
return t5;
|
|
1624
1953
|
};
|
|
1625
|
-
const useLogin = (
|
|
1954
|
+
const useLogin = (t0, t1)=>{
|
|
1955
|
+
const $ = c(21);
|
|
1956
|
+
const cRedirect = void 0 === t0 ? "/" : t0;
|
|
1957
|
+
const pRedirect = void 0 === t1 ? "/" : t1;
|
|
1626
1958
|
const { context } = useSecurityContext();
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1959
|
+
let t2;
|
|
1960
|
+
if ($[0] !== context) {
|
|
1961
|
+
t2 = context.getRecorder();
|
|
1962
|
+
$[0] = context;
|
|
1963
|
+
$[1] = t2;
|
|
1964
|
+
} else t2 = $[1];
|
|
1965
|
+
const recorder = t2;
|
|
1966
|
+
let t3;
|
|
1967
|
+
if ($[2] !== context) {
|
|
1968
|
+
t3 = context.getStorer();
|
|
1969
|
+
$[2] = context;
|
|
1970
|
+
$[3] = t3;
|
|
1971
|
+
} else t3 = $[3];
|
|
1972
|
+
const storer = t3;
|
|
1973
|
+
let t4;
|
|
1974
|
+
if ($[4] !== context) {
|
|
1975
|
+
t4 = context.getNavigator();
|
|
1976
|
+
$[4] = context;
|
|
1977
|
+
$[5] = t4;
|
|
1978
|
+
} else t4 = $[5];
|
|
1979
|
+
const navigator = t4;
|
|
1980
|
+
let t5;
|
|
1981
|
+
let t6;
|
|
1982
|
+
if ($[6] !== cRedirect || $[7] !== context || $[8] !== navigator || $[9] !== pRedirect || $[10] !== recorder || $[11] !== storer) {
|
|
1983
|
+
t5 = ()=>{
|
|
1984
|
+
const isAuthentication = recorder.existAccessAuthentication() || !!storer.loadAuthentication(recorder);
|
|
1985
|
+
if (isAuthentication) {
|
|
1986
|
+
const e_parent = context.getParent();
|
|
1987
|
+
if (e_parent && "" !== pRedirect) {
|
|
1988
|
+
const p_navigator = e_parent.getNavigator();
|
|
1989
|
+
p_navigator.navigate(pRedirect);
|
|
1990
|
+
} else if ("" !== cRedirect) {
|
|
1991
|
+
const path = recorder.getOriginPath();
|
|
1992
|
+
if (path) navigator.navigate(path);
|
|
1993
|
+
else navigator.navigate(cRedirect);
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
};
|
|
1997
|
+
t6 = [
|
|
1998
|
+
cRedirect,
|
|
1999
|
+
recorder,
|
|
2000
|
+
storer,
|
|
2001
|
+
navigator,
|
|
2002
|
+
context,
|
|
2003
|
+
pRedirect
|
|
2004
|
+
];
|
|
2005
|
+
$[6] = cRedirect;
|
|
2006
|
+
$[7] = context;
|
|
2007
|
+
$[8] = navigator;
|
|
2008
|
+
$[9] = pRedirect;
|
|
2009
|
+
$[10] = recorder;
|
|
2010
|
+
$[11] = storer;
|
|
2011
|
+
$[12] = t5;
|
|
2012
|
+
$[13] = t6;
|
|
2013
|
+
} else {
|
|
2014
|
+
t5 = $[12];
|
|
2015
|
+
t6 = $[13];
|
|
2016
|
+
}
|
|
2017
|
+
useEffect(t5, t6);
|
|
2018
|
+
let t7;
|
|
2019
|
+
if ($[14] !== cRedirect || $[15] !== context || $[16] !== navigator || $[17] !== pRedirect || $[18] !== recorder || $[19] !== storer) {
|
|
2020
|
+
t7 = (datasheet)=>{
|
|
2021
|
+
storer.saveAuthentication(recorder, datasheet);
|
|
2022
|
+
recorder.clearAccessAuthentication();
|
|
2023
|
+
recorder.clearAccessAuthorization();
|
|
2024
|
+
const r_parent = context.getParent();
|
|
2025
|
+
if (r_parent && "" !== pRedirect) {
|
|
2026
|
+
const p_navigator_0 = r_parent.getNavigator();
|
|
2027
|
+
p_navigator_0.navigate(pRedirect);
|
|
1637
2028
|
} else if ("" !== cRedirect) {
|
|
1638
|
-
const
|
|
1639
|
-
if (
|
|
2029
|
+
const path_0 = recorder.getOriginPath();
|
|
2030
|
+
if (path_0) navigator.navigate(path_0);
|
|
1640
2031
|
else navigator.navigate(cRedirect);
|
|
1641
2032
|
}
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
recorder.clearAccessAuthorization();
|
|
1653
|
-
const r_parent = context.getParent();
|
|
1654
|
-
if (r_parent && "" !== pRedirect) {
|
|
1655
|
-
const p_navigator = r_parent.getNavigator();
|
|
1656
|
-
p_navigator.navigate(pRedirect);
|
|
1657
|
-
} else if ("" !== cRedirect) {
|
|
1658
|
-
const path = recorder.getOriginPath();
|
|
1659
|
-
if (path) navigator.navigate(path);
|
|
1660
|
-
else navigator.navigate(cRedirect);
|
|
1661
|
-
}
|
|
1662
|
-
};
|
|
2033
|
+
};
|
|
2034
|
+
$[14] = cRedirect;
|
|
2035
|
+
$[15] = context;
|
|
2036
|
+
$[16] = navigator;
|
|
2037
|
+
$[17] = pRedirect;
|
|
2038
|
+
$[18] = recorder;
|
|
2039
|
+
$[19] = storer;
|
|
2040
|
+
$[20] = t7;
|
|
2041
|
+
} else t7 = $[20];
|
|
2042
|
+
return t7;
|
|
1663
2043
|
};
|
|
1664
2044
|
const useCustomBlocker = (handler)=>{
|
|
2045
|
+
const $ = c(6);
|
|
1665
2046
|
const { manager } = useSecurityContext();
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
2047
|
+
let t0;
|
|
2048
|
+
if ($[0] !== manager) {
|
|
2049
|
+
t0 = manager.getBlocker();
|
|
2050
|
+
$[0] = manager;
|
|
2051
|
+
$[1] = t0;
|
|
2052
|
+
} else t0 = $[1];
|
|
2053
|
+
const blocker = t0;
|
|
2054
|
+
let t1;
|
|
2055
|
+
let t2;
|
|
2056
|
+
if ($[2] !== blocker || $[3] !== handler) {
|
|
2057
|
+
t1 = ()=>{
|
|
2058
|
+
blocker.register(handler);
|
|
2059
|
+
return ()=>{
|
|
2060
|
+
blocker.unregister(handler);
|
|
2061
|
+
};
|
|
1671
2062
|
};
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
2063
|
+
t2 = [
|
|
2064
|
+
blocker,
|
|
2065
|
+
handler
|
|
2066
|
+
];
|
|
2067
|
+
$[2] = blocker;
|
|
2068
|
+
$[3] = handler;
|
|
2069
|
+
$[4] = t1;
|
|
2070
|
+
$[5] = t2;
|
|
2071
|
+
} else {
|
|
2072
|
+
t1 = $[4];
|
|
2073
|
+
t2 = $[5];
|
|
2074
|
+
}
|
|
2075
|
+
useEffect(t1, t2);
|
|
1676
2076
|
};
|
|
1677
|
-
const useSecurityBlocker = (
|
|
2077
|
+
const useSecurityBlocker = (t0)=>{
|
|
2078
|
+
const $ = c(17);
|
|
2079
|
+
const recover = void 0 === t0 ? true : t0;
|
|
1678
2080
|
const { context, manager } = useSecurityContext();
|
|
1679
2081
|
const [path, setPath] = useState();
|
|
1680
2082
|
const [jump, setJump] = useState(false);
|
|
1681
2083
|
const [blocked, setBlocked] = useState(false);
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
if (
|
|
1686
|
-
|
|
1687
|
-
|
|
2084
|
+
let t1;
|
|
2085
|
+
if ($[0] !== context || $[1] !== path || $[2] !== recover) {
|
|
2086
|
+
t1 = ()=>{
|
|
2087
|
+
if (path) {
|
|
2088
|
+
setJump(true);
|
|
2089
|
+
if (recover) {
|
|
2090
|
+
setPath(void 0);
|
|
2091
|
+
setBlocked(false);
|
|
2092
|
+
}
|
|
2093
|
+
context.getNavigator().navigate(path);
|
|
1688
2094
|
}
|
|
1689
|
-
context.getNavigator().navigate(path);
|
|
1690
|
-
}
|
|
1691
|
-
}, [
|
|
1692
|
-
context,
|
|
1693
|
-
path,
|
|
1694
|
-
recover
|
|
1695
|
-
]);
|
|
1696
|
-
const reset = useCallback(()=>{
|
|
1697
|
-
setPath(void 0);
|
|
1698
|
-
setJump(false);
|
|
1699
|
-
setBlocked(false);
|
|
1700
|
-
}, []);
|
|
1701
|
-
const handler = useCallback((context, currentPath, currentResource)=>{
|
|
1702
|
-
setJump(false);
|
|
1703
|
-
if (jump) return false;
|
|
1704
|
-
setPath(currentPath);
|
|
1705
|
-
setBlocked(true);
|
|
1706
|
-
return true;
|
|
1707
|
-
}, [
|
|
1708
|
-
jump
|
|
1709
|
-
]);
|
|
1710
|
-
const blocker = manager.getBlocker();
|
|
1711
|
-
useEffect(()=>{
|
|
1712
|
-
blocker.register(handler);
|
|
1713
|
-
return ()=>{
|
|
1714
|
-
blocker.unregister(handler);
|
|
1715
2095
|
};
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
2096
|
+
$[0] = context;
|
|
2097
|
+
$[1] = path;
|
|
2098
|
+
$[2] = recover;
|
|
2099
|
+
$[3] = t1;
|
|
2100
|
+
} else t1 = $[3];
|
|
2101
|
+
const proceed = t1;
|
|
2102
|
+
let t2;
|
|
2103
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2104
|
+
t2 = ()=>{
|
|
2105
|
+
setPath(void 0);
|
|
2106
|
+
setJump(false);
|
|
2107
|
+
setBlocked(false);
|
|
2108
|
+
};
|
|
2109
|
+
$[4] = t2;
|
|
2110
|
+
} else t2 = $[4];
|
|
2111
|
+
const reset = t2;
|
|
2112
|
+
let t3;
|
|
2113
|
+
if ($[5] !== jump) {
|
|
2114
|
+
t3 = (context_0, currentPath, currentResource)=>{
|
|
2115
|
+
setJump(false);
|
|
2116
|
+
if (jump) return false;
|
|
2117
|
+
setPath(currentPath);
|
|
2118
|
+
setBlocked(true);
|
|
2119
|
+
return true;
|
|
2120
|
+
};
|
|
2121
|
+
$[5] = jump;
|
|
2122
|
+
$[6] = t3;
|
|
2123
|
+
} else t3 = $[6];
|
|
2124
|
+
const handler = t3;
|
|
2125
|
+
let t4;
|
|
2126
|
+
if ($[7] !== manager) {
|
|
2127
|
+
t4 = manager.getBlocker();
|
|
2128
|
+
$[7] = manager;
|
|
2129
|
+
$[8] = t4;
|
|
2130
|
+
} else t4 = $[8];
|
|
2131
|
+
const blocker = t4;
|
|
2132
|
+
let t5;
|
|
2133
|
+
let t6;
|
|
2134
|
+
if ($[9] !== blocker || $[10] !== handler) {
|
|
2135
|
+
t5 = ()=>{
|
|
2136
|
+
blocker.register(handler);
|
|
2137
|
+
return ()=>{
|
|
2138
|
+
blocker.unregister(handler);
|
|
2139
|
+
};
|
|
2140
|
+
};
|
|
2141
|
+
t6 = [
|
|
2142
|
+
blocker,
|
|
2143
|
+
handler
|
|
2144
|
+
];
|
|
2145
|
+
$[9] = blocker;
|
|
2146
|
+
$[10] = handler;
|
|
2147
|
+
$[11] = t5;
|
|
2148
|
+
$[12] = t6;
|
|
2149
|
+
} else {
|
|
2150
|
+
t5 = $[11];
|
|
2151
|
+
t6 = $[12];
|
|
2152
|
+
}
|
|
2153
|
+
useEffect(t5, t6);
|
|
2154
|
+
let t7;
|
|
2155
|
+
if ($[13] !== blocked || $[14] !== path || $[15] !== proceed) {
|
|
2156
|
+
t7 = {
|
|
2157
|
+
blocked,
|
|
2158
|
+
proceed,
|
|
2159
|
+
reset,
|
|
2160
|
+
path
|
|
2161
|
+
};
|
|
2162
|
+
$[13] = blocked;
|
|
2163
|
+
$[14] = path;
|
|
2164
|
+
$[15] = proceed;
|
|
2165
|
+
$[16] = t7;
|
|
2166
|
+
} else t7 = $[16];
|
|
2167
|
+
return t7;
|
|
1726
2168
|
};
|
|
1727
|
-
function HavePermission(
|
|
2169
|
+
function HavePermission(t0) {
|
|
2170
|
+
const { children, term } = t0;
|
|
1728
2171
|
const havePermission = useHavePermission();
|
|
1729
2172
|
const have = havePermission(term);
|
|
1730
|
-
if (!have) return
|
|
1731
|
-
return
|
|
1732
|
-
children: children
|
|
1733
|
-
});
|
|
2173
|
+
if (!have) return null;
|
|
2174
|
+
return children;
|
|
1734
2175
|
}
|
|
1735
2176
|
const withHavePermission = (Component, term)=>()=>/*#__PURE__*/ jsx(HavePermission, {
|
|
1736
2177
|
term: term,
|
|
@@ -1752,8 +2193,8 @@ class MicroAppAddon extends AbstractAddon {
|
|
|
1752
2193
|
guardBefore(context, manager, currentPath, currentResource) {
|
|
1753
2194
|
if (this.microJoin) return;
|
|
1754
2195
|
if (window.__MICRO_APP_BASE_APPLICATION__) {
|
|
1755
|
-
window.
|
|
1756
|
-
window.
|
|
2196
|
+
window.__AQI_RSR_MICRO_APP_PARENT_CONTEXT__ = context;
|
|
2197
|
+
window.__AQI_RSR_MICRO_APP_PARENT_MANAGER__ = manager;
|
|
1757
2198
|
}
|
|
1758
2199
|
if (window.__MICRO_APP_ENVIRONMENT__) {
|
|
1759
2200
|
if (this.basenameJoin) {
|
|
@@ -1763,7 +2204,7 @@ class MicroAppAddon extends AbstractAddon {
|
|
|
1763
2204
|
matcher.setBasename(baseRoute);
|
|
1764
2205
|
}
|
|
1765
2206
|
}
|
|
1766
|
-
const c_parent = window.rawWindow?.
|
|
2207
|
+
const c_parent = window.rawWindow?.__AQI_RSR_MICRO_APP_PARENT_CONTEXT__;
|
|
1767
2208
|
if (c_parent) {
|
|
1768
2209
|
if (!context.getParent()) context.setParent(c_parent);
|
|
1769
2210
|
if (this.hierarchyJoin !== MicroAppAddon.HIERARCHY_JOIN_IGNORE) {
|
|
@@ -1776,7 +2217,7 @@ class MicroAppAddon extends AbstractAddon {
|
|
|
1776
2217
|
}
|
|
1777
2218
|
}
|
|
1778
2219
|
}
|
|
1779
|
-
const m_parent = window.rawWindow?.
|
|
2220
|
+
const m_parent = window.rawWindow?.__AQI_RSR_MICRO_APP_PARENT_MANAGER__;
|
|
1780
2221
|
if (m_parent) {
|
|
1781
2222
|
if (!manager.getParent()) manager.setParent(m_parent);
|
|
1782
2223
|
}
|
|
@@ -1785,4 +2226,4 @@ class MicroAppAddon extends AbstractAddon {
|
|
|
1785
2226
|
}
|
|
1786
2227
|
}
|
|
1787
2228
|
const microAppAddon = (basenameJoin = true, hierarchyJoin = MicroAppAddon.HIERARCHY_JOIN_IGNORE)=>new MicroAppAddon(basenameJoin, hierarchyJoin);
|
|
1788
|
-
export { AbstractAddon,
|
|
2229
|
+
export { AbstractAddon, AccessBlockerBuilder, AccessContextBuilder, AccessGuarderBuilder, AccessHandlerBuilder, AccessManagerBuilder, AccessMatcherBuilder, AccessNavigatorBuilder, AccessRecorderBuilder, AccessResourceBuilder, AccessStorerBuilder, AccessVoterBuilder, BehaveHandler, CacheVoter, HavePermission, HierarchyVoter, MicroAppAddon, MultiBlocker, OriginRelationResolver, SecurityBlocker, SecurityContext, SecurityProvider, SimpleAuthentication, SimpleAuthorization, SimpleContext, SimpleGuarder, SimpleManager, SimpleMatcher, SimpleNavigator, SimpleRecorder, SimpleResource, SimpleStorer, SimpleUser, SimpleVoter, SingleBlocker, common_AccessBehave as AccessBehave, common_AccessDecision as AccessDecision, microAppAddon, useCustomBlocker, useDeleteAuthentication, useDeleteAuthorization, useDeleteSignature, useHavePermission, useLogin, useLogout, useObtainAuthentication, useObtainAuthorization, usePurgeSignature, useRemoveSignature, useSaveAuthentication, useSaveAuthorization, useSaveSignature, useSecurityBlocker, useSecurityContext, withHavePermission, withSecurityBlocker };
|