@hitchy/plugin-auth 0.3.0 → 0.3.1
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/api/policy/authentication.js +80 -26
- package/api/service/auth/manager.js +36 -4
- package/api/service/authentication/passport.js +6 -5
- package/api/service/authentication/strategies.js +57 -34
- package/api/service/authorization/tree.js +8 -8
- package/coverage/index.html +38 -38
- package/coverage/plugin-auth/api/controller/index.html +1 -1
- package/coverage/plugin-auth/api/controller/user.js.html +1 -1
- package/coverage/plugin-auth/api/model/authorization/index.html +1 -1
- package/coverage/plugin-auth/api/model/authorization/rule.js.html +1 -1
- package/coverage/plugin-auth/api/model/index.html +1 -1
- package/coverage/plugin-auth/api/model/role.js.html +1 -1
- package/coverage/plugin-auth/api/model/user-to-role.js.html +1 -1
- package/coverage/plugin-auth/api/model/user.js.html +1 -1
- package/coverage/plugin-auth/api/policy/authentication.js.html +215 -50
- package/coverage/plugin-auth/api/policy/authorization.js.html +1 -1
- package/coverage/plugin-auth/api/policy/index.html +18 -18
- package/coverage/plugin-auth/api/policy/user.js.html +1 -1
- package/coverage/plugin-auth/api/service/auth/index.html +17 -17
- package/coverage/plugin-auth/api/service/auth/manager.js.html +109 -13
- package/coverage/plugin-auth/api/service/authentication/index.html +25 -25
- package/coverage/plugin-auth/api/service/authentication/passport.js.html +14 -11
- package/coverage/plugin-auth/api/service/authentication/strategies.js.html +132 -63
- package/coverage/plugin-auth/api/service/authorization/index.html +1 -1
- package/coverage/plugin-auth/api/service/authorization/node.js.html +1 -1
- package/coverage/plugin-auth/api/service/authorization/policy-generator.js.html +1 -1
- package/coverage/plugin-auth/api/service/authorization/tree.js.html +9 -9
- package/coverage/plugin-auth/config/auth.js.html +1 -1
- package/coverage/plugin-auth/config/index.html +1 -1
- package/coverage/plugin-auth/index.html +1 -1
- package/coverage/plugin-auth/index.js.html +2 -2
- package/coverage/tmp/coverage-8472-1648414315419-0.json +1 -0
- package/index.js +4 -1
- package/package.json +1 -1
- package/coverage/tmp/coverage-6744-1648396809135-0.json +0 -1
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">79.5% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>225/283</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">78.12% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>25/32</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">84.61% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>11/
|
|
42
|
+
<span class='fraction'>11/13</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">79.5% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>225/283</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
56
|
</p>
|
|
57
57
|
</div>
|
|
58
|
-
<div class='status-line
|
|
58
|
+
<div class='status-line medium'></div>
|
|
59
59
|
<pre><table class="coverage">
|
|
60
60
|
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
61
61
|
<a name='L2'></a><a href='#L2'>2</a>
|
|
@@ -317,7 +317,30 @@
|
|
|
317
317
|
<a name='L258'></a><a href='#L258'>258</a>
|
|
318
318
|
<a name='L259'></a><a href='#L259'>259</a>
|
|
319
319
|
<a name='L260'></a><a href='#L260'>260</a>
|
|
320
|
-
<a name='L261'></a><a href='#L261'>261</a
|
|
320
|
+
<a name='L261'></a><a href='#L261'>261</a>
|
|
321
|
+
<a name='L262'></a><a href='#L262'>262</a>
|
|
322
|
+
<a name='L263'></a><a href='#L263'>263</a>
|
|
323
|
+
<a name='L264'></a><a href='#L264'>264</a>
|
|
324
|
+
<a name='L265'></a><a href='#L265'>265</a>
|
|
325
|
+
<a name='L266'></a><a href='#L266'>266</a>
|
|
326
|
+
<a name='L267'></a><a href='#L267'>267</a>
|
|
327
|
+
<a name='L268'></a><a href='#L268'>268</a>
|
|
328
|
+
<a name='L269'></a><a href='#L269'>269</a>
|
|
329
|
+
<a name='L270'></a><a href='#L270'>270</a>
|
|
330
|
+
<a name='L271'></a><a href='#L271'>271</a>
|
|
331
|
+
<a name='L272'></a><a href='#L272'>272</a>
|
|
332
|
+
<a name='L273'></a><a href='#L273'>273</a>
|
|
333
|
+
<a name='L274'></a><a href='#L274'>274</a>
|
|
334
|
+
<a name='L275'></a><a href='#L275'>275</a>
|
|
335
|
+
<a name='L276'></a><a href='#L276'>276</a>
|
|
336
|
+
<a name='L277'></a><a href='#L277'>277</a>
|
|
337
|
+
<a name='L278'></a><a href='#L278'>278</a>
|
|
338
|
+
<a name='L279'></a><a href='#L279'>279</a>
|
|
339
|
+
<a name='L280'></a><a href='#L280'>280</a>
|
|
340
|
+
<a name='L281'></a><a href='#L281'>281</a>
|
|
341
|
+
<a name='L282'></a><a href='#L282'>282</a>
|
|
342
|
+
<a name='L283'></a><a href='#L283'>283</a>
|
|
343
|
+
<a name='L284'></a><a href='#L284'>284</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
321
344
|
<span class="cline-any cline-yes">1x</span>
|
|
322
345
|
<span class="cline-any cline-yes">1x</span>
|
|
323
346
|
<span class="cline-any cline-yes">1x</span>
|
|
@@ -383,37 +406,60 @@
|
|
|
383
406
|
<span class="cline-any cline-yes">18x</span>
|
|
384
407
|
<span class="cline-any cline-yes">18x</span>
|
|
385
408
|
<span class="cline-any cline-yes">18x</span>
|
|
386
|
-
<span class="cline-any cline-yes">
|
|
387
|
-
<span class="cline-any cline-yes">
|
|
388
|
-
<span class="cline-any cline-
|
|
389
|
-
<span class="cline-any cline-
|
|
390
|
-
<span class="cline-any cline-
|
|
409
|
+
<span class="cline-any cline-yes">18x</span>
|
|
410
|
+
<span class="cline-any cline-yes">18x</span>
|
|
411
|
+
<span class="cline-any cline-no"> </span>
|
|
412
|
+
<span class="cline-any cline-no"> </span>
|
|
413
|
+
<span class="cline-any cline-no"> </span>
|
|
414
|
+
<span class="cline-any cline-no"> </span>
|
|
415
|
+
<span class="cline-any cline-no"> </span>
|
|
416
|
+
<span class="cline-any cline-no"> </span>
|
|
417
|
+
<span class="cline-any cline-no"> </span>
|
|
418
|
+
<span class="cline-any cline-no"> </span>
|
|
419
|
+
<span class="cline-any cline-no"> </span>
|
|
420
|
+
<span class="cline-any cline-no"> </span>
|
|
421
|
+
<span class="cline-any cline-no"> </span>
|
|
422
|
+
<span class="cline-any cline-no"> </span>
|
|
423
|
+
<span class="cline-any cline-no"> </span>
|
|
424
|
+
<span class="cline-any cline-no"> </span>
|
|
425
|
+
<span class="cline-any cline-no"> </span>
|
|
426
|
+
<span class="cline-any cline-no"> </span>
|
|
427
|
+
<span class="cline-any cline-no"> </span>
|
|
428
|
+
<span class="cline-any cline-no"> </span>
|
|
429
|
+
<span class="cline-any cline-no"> </span>
|
|
430
|
+
<span class="cline-any cline-no"> </span>
|
|
431
|
+
<span class="cline-any cline-no"> </span>
|
|
432
|
+
<span class="cline-any cline-no"> </span>
|
|
391
433
|
<span class="cline-any cline-no"> </span>
|
|
392
434
|
<span class="cline-any cline-no"> </span>
|
|
393
|
-
<span class="cline-any cline-yes">9x</span>
|
|
394
|
-
<span class="cline-any cline-yes">9x</span>
|
|
395
|
-
<span class="cline-any cline-yes">9x</span>
|
|
396
|
-
<span class="cline-any cline-yes">9x</span>
|
|
397
|
-
<span class="cline-any cline-yes">9x</span>
|
|
398
435
|
<span class="cline-any cline-no"> </span>
|
|
399
436
|
<span class="cline-any cline-no"> </span>
|
|
400
437
|
<span class="cline-any cline-no"> </span>
|
|
401
|
-
<span class="cline-any cline-yes">9x</span>
|
|
402
|
-
<span class="cline-any cline-yes">9x</span>
|
|
403
|
-
<span class="cline-any cline-yes">9x</span>
|
|
404
|
-
<span class="cline-any cline-yes">9x</span>
|
|
405
|
-
<span class="cline-any cline-yes">9x</span>
|
|
406
438
|
<span class="cline-any cline-no"> </span>
|
|
407
439
|
<span class="cline-any cline-no"> </span>
|
|
440
|
+
<span class="cline-any cline-no"> </span>
|
|
441
|
+
<span class="cline-any cline-no"> </span>
|
|
442
|
+
<span class="cline-any cline-no"> </span>
|
|
443
|
+
<span class="cline-any cline-no"> </span>
|
|
444
|
+
<span class="cline-any cline-no"> </span>
|
|
445
|
+
<span class="cline-any cline-no"> </span>
|
|
446
|
+
<span class="cline-any cline-yes">18x</span>
|
|
447
|
+
<span class="cline-any cline-yes">18x</span>
|
|
448
|
+
<span class="cline-any cline-yes">18x</span>
|
|
449
|
+
<span class="cline-any cline-yes">18x</span>
|
|
450
|
+
<span class="cline-any cline-yes">18x</span>
|
|
451
|
+
<span class="cline-any cline-yes">18x</span>
|
|
452
|
+
<span class="cline-any cline-yes">18x</span>
|
|
453
|
+
<span class="cline-any cline-yes">18x</span>
|
|
454
|
+
<span class="cline-any cline-yes">18x</span>
|
|
455
|
+
<span class="cline-any cline-yes">9x</span>
|
|
408
456
|
<span class="cline-any cline-yes">9x</span>
|
|
409
457
|
<span class="cline-any cline-yes">9x</span>
|
|
410
458
|
<span class="cline-any cline-yes">9x</span>
|
|
411
459
|
<span class="cline-any cline-yes">9x</span>
|
|
412
460
|
<span class="cline-any cline-no"> </span>
|
|
413
461
|
<span class="cline-any cline-no"> </span>
|
|
414
|
-
<span class="cline-any cline-
|
|
415
|
-
<span class="cline-any cline-yes">9x</span>
|
|
416
|
-
<span class="cline-any cline-yes">9x</span>
|
|
462
|
+
<span class="cline-any cline-no"> </span>
|
|
417
463
|
<span class="cline-any cline-no"> </span>
|
|
418
464
|
<span class="cline-any cline-no"> </span>
|
|
419
465
|
<span class="cline-any cline-yes">9x</span>
|
|
@@ -596,9 +642,9 @@ const RemoteAuthCustomData = new Map();
|
|
|
596
642
|
|
|
597
643
|
module.exports = function() {
|
|
598
644
|
const api = this;
|
|
599
|
-
const { models } = api.runtime;
|
|
645
|
+
const { models, services } = api.runtime;
|
|
600
646
|
|
|
601
|
-
const
|
|
647
|
+
const logAlert = api.log( "hitchy:plugin:auth:alert" );
|
|
602
648
|
|
|
603
649
|
/**
|
|
604
650
|
* Fetches named user's local profile.
|
|
@@ -635,6 +681,52 @@ module.exports = function() {
|
|
|
635
681
|
* Implements helpers for generating strategies for passport.js.
|
|
636
682
|
*/
|
|
637
683
|
class AuthenticationStrategies {
|
|
684
|
+
/**
|
|
685
|
+
* Picks user based on provided name and checks if provided password is
|
|
686
|
+
* matching or not.
|
|
687
|
+
*
|
|
688
|
+
* @param {string} username name of user to authenticate
|
|
689
|
+
* @param {string} password named user's password for authentication
|
|
690
|
+
* @param {function(Error?, object, object)} done invoked with optional error, authenticated user or some message as feedback
|
|
691
|
+
* @returns {void}
|
|
692
|
+
*/
|
|
693
|
+
static <span class="fstat-no" title="function not covered" >checkAuthentication( username, password, done ) {</span>
|
|
694
|
+
<span class="cstat-no" title="statement not covered" > models.User</span>
|
|
695
|
+
<span class="cstat-no" title="statement not covered" > .find( { eq: { username } }, {}, { loadRecords: true } )</span>
|
|
696
|
+
<span class="cstat-no" title="statement not covered" > .then( matches => {</span>
|
|
697
|
+
<span class="cstat-no" title="statement not covered" > switch ( matches.length ) {</span>
|
|
698
|
+
<span class="cstat-no" title="statement not covered" > case 0 :</span>
|
|
699
|
+
<span class="cstat-no" title="statement not covered" > done( null, false, { message: "Incorrect username." } );</span>
|
|
700
|
+
<span class="cstat-no" title="statement not covered" > return undefined;</span>
|
|
701
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
702
|
+
<span class="cstat-no" title="statement not covered" > case 1 : {</span>
|
|
703
|
+
<span class="cstat-no" title="statement not covered" > const [user] = matches;</span>
|
|
704
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
705
|
+
<span class="cstat-no" title="statement not covered" > if ( user.strategy && user.strategy !== "local" ) {</span>
|
|
706
|
+
<span class="cstat-no" title="statement not covered" > done( null, false, { message: "Authenticating this user requires different strategy." } );</span>
|
|
707
|
+
<span class="cstat-no" title="statement not covered" > return undefined;</span>
|
|
708
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
709
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
710
|
+
<span class="cstat-no" title="statement not covered" > return user.verifyPassword( password ).then( result => {</span>
|
|
711
|
+
<span class="cstat-no" title="statement not covered" > if ( result ) {</span>
|
|
712
|
+
<span class="cstat-no" title="statement not covered" > done( null, user );</span>
|
|
713
|
+
<span class="cstat-no" title="statement not covered" > } else {</span>
|
|
714
|
+
<span class="cstat-no" title="statement not covered" > done( null, false, { message: "Incorrect password." } );</span>
|
|
715
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
716
|
+
<span class="cstat-no" title="statement not covered" > } );</span>
|
|
717
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
718
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
719
|
+
<span class="cstat-no" title="statement not covered" > default :</span>
|
|
720
|
+
<span class="cstat-no" title="statement not covered" > done( null, false, { message: "Ambiguous username." } );</span>
|
|
721
|
+
<span class="cstat-no" title="statement not covered" > return undefined;</span>
|
|
722
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
723
|
+
<span class="cstat-no" title="statement not covered" > } )</span>
|
|
724
|
+
<span class="cstat-no" title="statement not covered" > .catch( err => {</span>
|
|
725
|
+
<span class="cstat-no" title="statement not covered" > logAlert( err );</span>
|
|
726
|
+
<span class="cstat-no" title="statement not covered" > done( err );</span>
|
|
727
|
+
<span class="cstat-no" title="statement not covered" > } );</span>
|
|
728
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
729
|
+
|
|
638
730
|
/**
|
|
639
731
|
* Generates local strategy authenticating user based on local user
|
|
640
732
|
* model managed in local ODM.
|
|
@@ -643,39 +735,16 @@ module.exports = function() {
|
|
|
643
735
|
*/
|
|
644
736
|
static generateLocal() {
|
|
645
737
|
const strategy = new LocalStrategy( ( name, password, done ) => {
|
|
646
|
-
|
|
647
|
-
.
|
|
648
|
-
|
|
649
|
-
switch ( matches.length ) {
|
|
650
|
-
<span class="branch-0 cbranch-no" title="branch not covered" > case 0 :</span>
|
|
651
|
-
<span class="cstat-no" title="statement not covered" > done( null, false, { message: "Incorrect username." } );</span>
|
|
652
|
-
<span class="cstat-no" title="statement not covered" > return undefined;</span>
|
|
653
|
-
|
|
654
|
-
case 1 : {
|
|
655
|
-
const [user] = matches;
|
|
656
|
-
|
|
657
|
-
if ( user.strategy <span class="branch-0 cbranch-no" title="branch not covered" >&& user.strategy !== "local" </span>) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
|
|
658
|
-
<span class="cstat-no" title="statement not covered" > done( null, false, { message: "Authenticating this user requires different strategy." } );</span>
|
|
659
|
-
<span class="cstat-no" title="statement not covered" > return undefined;</span>
|
|
660
|
-
<span class="cstat-no" title="statement not covered" > }</span>
|
|
661
|
-
|
|
662
|
-
return user.verifyPassword( password ).then( result => {
|
|
663
|
-
if ( result ) {
|
|
664
|
-
done( null, user );
|
|
665
|
-
}<span class="branch-0 cbranch-no" title="branch not covered" > else {</span>
|
|
666
|
-
<span class="cstat-no" title="statement not covered" > done( null, false, { message: "Incorrect password." } );</span>
|
|
667
|
-
<span class="cstat-no" title="statement not covered" > }</span>
|
|
668
|
-
} );
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
<span class="branch-0 cbranch-no" title="branch not covered" > default :</span>
|
|
672
|
-
<span class="cstat-no" title="statement not covered" > done( null, false, { message: "Ambiguous username." } );</span>
|
|
673
|
-
<span class="cstat-no" title="statement not covered" > return undefined;</span>
|
|
674
|
-
}
|
|
738
|
+
services.AuthManager.checkAuthentication( name, password, done )
|
|
739
|
+
.then( user => {
|
|
740
|
+
done( null, user );
|
|
675
741
|
} )
|
|
676
|
-
.catch(
|
|
677
|
-
<span class="cstat-no" title="statement not covered" >
|
|
678
|
-
<span class="cstat-no" title="statement not covered" >
|
|
742
|
+
.catch( error => {
|
|
743
|
+
<span class="cstat-no" title="statement not covered" > if ( error instanceof services.HttpException && error.statusCode === 400 ) {</span>
|
|
744
|
+
<span class="cstat-no" title="statement not covered" > done( null, false, { message: error.message } );</span>
|
|
745
|
+
<span class="cstat-no" title="statement not covered" > } else {</span>
|
|
746
|
+
<span class="cstat-no" title="statement not covered" > done( error );</span>
|
|
747
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
679
748
|
} );
|
|
680
749
|
} );
|
|
681
750
|
|
|
@@ -844,7 +913,7 @@ module.exports = function() {
|
|
|
844
913
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
845
914
|
Code coverage generated by
|
|
846
915
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
847
|
-
at Sun Mar 27 2022
|
|
916
|
+
at Sun Mar 27 2022 22:51:56 GMT+0200 (Mitteleuropäische Sommerzeit)
|
|
848
917
|
</div>
|
|
849
918
|
</div>
|
|
850
919
|
<script src="../../../../prettify.js"></script>
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
126
126
|
Code coverage generated by
|
|
127
127
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
128
|
-
at Sun Mar 27 2022
|
|
128
|
+
at Sun Mar 27 2022 22:51:56 GMT+0200 (Mitteleuropäische Sommerzeit)
|
|
129
129
|
</div>
|
|
130
130
|
</div>
|
|
131
131
|
<script src="../../../../prettify.js"></script>
|
|
@@ -928,7 +928,7 @@ module.exports = function() {
|
|
|
928
928
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
929
929
|
Code coverage generated by
|
|
930
930
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
931
|
-
at Sun Mar 27 2022
|
|
931
|
+
at Sun Mar 27 2022 22:51:56 GMT+0200 (Mitteleuropäische Sommerzeit)
|
|
932
932
|
</div>
|
|
933
933
|
</div>
|
|
934
934
|
<script src="../../../../prettify.js"></script>
|
|
@@ -370,7 +370,7 @@ module.exports = function() {
|
|
|
370
370
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
371
371
|
Code coverage generated by
|
|
372
372
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
373
|
-
at Sun Mar 27 2022
|
|
373
|
+
at Sun Mar 27 2022 22:51:56 GMT+0200 (Mitteleuropäische Sommerzeit)
|
|
374
374
|
</div>
|
|
375
375
|
</div>
|
|
376
376
|
<script src="../../../../prettify.js"></script>
|
|
@@ -665,8 +665,8 @@ module.exports = function() {
|
|
|
665
665
|
const api = this;
|
|
666
666
|
const { services, models } = api.runtime;
|
|
667
667
|
|
|
668
|
-
const
|
|
669
|
-
const
|
|
668
|
+
const logAlert = api.log( "hitchy:plugin:auth:alert" );
|
|
669
|
+
const logDebug = api.log( "hitchy:plugin:auth:debug" );
|
|
670
670
|
|
|
671
671
|
let cachedTree;
|
|
672
672
|
|
|
@@ -763,7 +763,7 @@ module.exports = function() {
|
|
|
763
763
|
addRule( rule ) {
|
|
764
764
|
const { selector, role, user, accept } = rule;
|
|
765
765
|
|
|
766
|
-
|
|
766
|
+
logDebug( "adding authorization rule", { selector, role, user, accept } );
|
|
767
767
|
|
|
768
768
|
const node = this.selectNode( selector );
|
|
769
769
|
|
|
@@ -787,7 +787,7 @@ module.exports = function() {
|
|
|
787
787
|
removeRule( rule ) {
|
|
788
788
|
const { selector, role, user, accept } = rule;
|
|
789
789
|
|
|
790
|
-
|
|
790
|
+
logDebug( "removing authorization rule", { selector, role, user, accept } );
|
|
791
791
|
|
|
792
792
|
const node = this.selectNode( selector, false );
|
|
793
793
|
|
|
@@ -830,7 +830,7 @@ module.exports = function() {
|
|
|
830
830
|
}
|
|
831
831
|
} );
|
|
832
832
|
} catch ( cause ) {
|
|
833
|
-
|
|
833
|
+
logAlert( cause.message );
|
|
834
834
|
return false;
|
|
835
835
|
}
|
|
836
836
|
|
|
@@ -874,7 +874,7 @@ module.exports = function() {
|
|
|
874
874
|
<span class="cstat-no" title="statement not covered" > const users = {};</span>
|
|
875
875
|
<span class="cstat-no" title="statement not covered" > const roles = {};</span>
|
|
876
876
|
<span class="cstat-no" title="statement not covered" ></span>
|
|
877
|
-
<span class="cstat-no" title="statement not covered" >
|
|
877
|
+
<span class="cstat-no" title="statement not covered" > logDebug( `restoring ${entries.length} authorization rule(s) from database` );</span>
|
|
878
878
|
<span class="cstat-no" title="statement not covered" ></span>
|
|
879
879
|
<span class="cstat-no" title="statement not covered" > for ( const entry of entries ) {</span>
|
|
880
880
|
<span class="cstat-no" title="statement not covered" > const userKey = entry.user ? entry.user.toString( "hex" ) : undefined;</span>
|
|
@@ -912,7 +912,7 @@ module.exports = function() {
|
|
|
912
912
|
loadFromConfiguration( configuration ) {
|
|
913
913
|
const { authorizations = {} } = configuration <span class="branch-0 cbranch-no" title="branch not covered" >|| {};</span>
|
|
914
914
|
|
|
915
|
-
|
|
915
|
+
logDebug( `loading authorization(s) from configuration` );
|
|
916
916
|
|
|
917
917
|
const processLevel = ( source, prefix ) => {
|
|
918
918
|
const names = Object.keys( source );
|
|
@@ -943,7 +943,7 @@ module.exports = function() {
|
|
|
943
943
|
[isRole ? "role" : "user"]: id,
|
|
944
944
|
} );
|
|
945
945
|
}<span class="branch-0 cbranch-no" title="branch not covered" > else {</span>
|
|
946
|
-
<span class="cstat-no" title="statement not covered" >
|
|
946
|
+
<span class="cstat-no" title="statement not covered" > logAlert( `invalid user/role selector in ${key || "rule"} on ${name}` );</span>
|
|
947
947
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
948
948
|
}
|
|
949
949
|
}
|
|
@@ -967,7 +967,7 @@ module.exports = function() {
|
|
|
967
967
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
968
968
|
Code coverage generated by
|
|
969
969
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
970
|
-
at Sun Mar 27 2022
|
|
970
|
+
at Sun Mar 27 2022 22:51:56 GMT+0200 (Mitteleuropäische Sommerzeit)
|
|
971
971
|
</div>
|
|
972
972
|
</div>
|
|
973
973
|
<script src="../../../../prettify.js"></script>
|
|
@@ -124,7 +124,7 @@ module.exports = function() {
|
|
|
124
124
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
125
125
|
Code coverage generated by
|
|
126
126
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
127
|
-
at Sun Mar 27 2022
|
|
127
|
+
at Sun Mar 27 2022 22:51:56 GMT+0200 (Mitteleuropäische Sommerzeit)
|
|
128
128
|
</div>
|
|
129
129
|
</div>
|
|
130
130
|
<script src="../../prettify.js"></script>
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
96
96
|
Code coverage generated by
|
|
97
97
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
98
|
-
at Sun Mar 27 2022
|
|
98
|
+
at Sun Mar 27 2022 22:51:56 GMT+0200 (Mitteleuropäische Sommerzeit)
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
101
|
<script src="../../prettify.js"></script>
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
96
96
|
Code coverage generated by
|
|
97
97
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
98
|
-
at Sun Mar 27 2022
|
|
98
|
+
at Sun Mar 27 2022 22:51:56 GMT+0200 (Mitteleuropäische Sommerzeit)
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
101
|
<script src="../prettify.js"></script>
|
|
@@ -284,7 +284,7 @@ module.exports = function( options, plugins ) {
|
|
|
284
284
|
const { config: { auth: { prefix } } } = this;
|
|
285
285
|
|
|
286
286
|
const policies = {
|
|
287
|
-
"/": "authentication.initialize",
|
|
287
|
+
"/": ["authentication.initialize", "authentication.handleBasicAuth"],
|
|
288
288
|
};
|
|
289
289
|
|
|
290
290
|
return prefix === false <span class="branch-0 cbranch-no" title="branch not covered" >? policies </span>: {
|
|
@@ -328,7 +328,7 @@ module.exports = function( options, plugins ) {
|
|
|
328
328
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
329
329
|
Code coverage generated by
|
|
330
330
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
331
|
-
at Sun Mar 27 2022
|
|
331
|
+
at Sun Mar 27 2022 22:51:56 GMT+0200 (Mitteleuropäische Sommerzeit)
|
|
332
332
|
</div>
|
|
333
333
|
</div>
|
|
334
334
|
<script src="../prettify.js"></script>
|