@@ -28,11 +28,6 @@ component accessors="true" extends="coldbox.system.Interceptor" {
28
28
* Configure the security firewall
29
29
*/
30
30
function configure (){
31
- variables .onInvalidEventHandlerBean = javacast ( " null" , " " );
32
- if ( len ( variables .invalidEventHandler ) ) {
33
- variables .onInvalidEventHandlerBean = handlerService .getHandlerBean ( variables .invalidEventHandler );
34
- }
35
-
36
31
// init the security modules dictionary
37
32
variables .securityModules = {};
38
33
@@ -49,10 +44,7 @@ component accessors="true" extends="coldbox.system.Interceptor" {
49
44
setProperty ( " rules" , variables .rulesLoader .loadRules ( getProperties () ) );
50
45
}
51
46
52
- // Load up the validator
53
- registerValidator ( getInstance ( getProperty ( " validator" ) ) );
54
-
55
- // Coldbox version 5 (and lower) needs a little extra invalid event handler checking.
47
+ // Coldbox version 5 (and lower) needs a little extra invalid event handler checking.
56
48
variables .enableInvalidHandlerCheck = ( listGetAt ( controller .getColdboxSettings ().version , 1 , " ." ) <= 5 );
57
49
}
58
50
@@ -66,6 +58,10 @@ component accessors="true" extends="coldbox.system.Interceptor" {
66
58
prc ,
67
59
buffer
68
60
){
61
+
62
+ // Register the validator
63
+ registerValidator ( getInstance ( getProperty ( " validator" ) ) );
64
+
69
65
// Register cbSecurity modules so we can incorporate them.
70
66
controller
71
67
.getSetting ( " modules" )
@@ -82,6 +78,12 @@ component accessors="true" extends="coldbox.system.Interceptor" {
82
78
// Register Module
83
79
registerModule ( arguments .module , arguments .config .settings .cbSecurity );
84
80
} );
81
+
82
+ // Once ColdBox has loaded, load up the invalid event bean
83
+ variables .onInvalidEventHandlerBean = javacast ( " null" , " " );
84
+ if ( len ( variables .invalidEventHandler ) ) {
85
+ variables .onInvalidEventHandlerBean = handlerService .getHandlerBean ( variables .invalidEventHandler );
86
+ }
85
87
}
86
88
87
89
/**
@@ -241,14 +243,14 @@ component accessors="true" extends="coldbox.system.Interceptor" {
241
243
){
242
244
// Get handler bean for the current event
243
245
var handlerBean = variables .handlerService .getHandlerBean ( arguments .event .getCurrentEvent () );
244
-
246
+
245
247
// Are we running Coldbox 5 or older?
246
248
// is an onInvalidHandlerBean configured?
247
249
// is the current handlerBean the configured onInvalidEventHandlerBean?
248
- if (
249
- variables .enableInvalidHandlerCheck &&
250
- ! isNull ( variables .onInvalidEventHandlerBean ) &&
251
- isInvalidEventHandlerBean ( handlerBean )
250
+ if (
251
+ variables .enableInvalidHandlerCheck &&
252
+ ! isNull ( variables .onInvalidEventHandlerBean ) &&
253
+ isInvalidEventHandlerBean ( handlerBean )
252
254
) {
253
255
// ColdBox tries to detect invalid event handler loops by keeping
254
256
// track of the last invalid event to fire. If that invalid event
@@ -260,7 +262,7 @@ component accessors="true" extends="coldbox.system.Interceptor" {
260
262
request ._lastInvalidEvent = variables .invalidEventHandler ;
261
263
return ;
262
264
}
263
-
265
+
264
266
if ( handlerBean .getHandler () == " " ) {
265
267
return ;
266
268
}
@@ -555,13 +557,9 @@ component accessors="true" extends="coldbox.system.Interceptor" {
555
557
* @return { allow:boolean, type:string(authentication|authorization)}
556
558
*/
557
559
private struct function verifySecuredAnnotation ( required securedValue , required event ){
558
- // If no value, then default it to true
559
- if ( ! len ( arguments .securedValue ) ) {
560
- arguments .securedValue = true ;
561
- }
562
560
563
561
// Are we securing?
564
- if ( isBoolean ( arguments .securedValue ) && ! arguments .securedValue ) {
562
+ if ( len ( arguments . securedValue ) && isBoolean ( arguments .securedValue ) && ! arguments .securedValue ) {
565
563
return {
566
564
" allow" : true ,
567
565
" type" : " authentication"
@@ -741,7 +739,7 @@ component accessors="true" extends="coldbox.system.Interceptor" {
741
739
742
740
return len ( CGI .REMOTE_ADDR ) ? CGI .REMOTE_ADDR : " 127.0.0.1" ;
743
741
}
744
-
742
+
745
743
/**
746
744
* Returns true of the passed handlerBean matches Coldbox's configured invalid event handler.
747
745
*
0 commit comments