@@ -28,11 +28,6 @@ component accessors="true" extends="coldbox.system.Interceptor" {
2828 * Configure the security firewall
2929 */
3030 function configure (){
31- variables .onInvalidEventHandlerBean = javacast ( " null" , " " );
32- if ( len ( variables .invalidEventHandler ) ) {
33- variables .onInvalidEventHandlerBean = handlerService .getHandlerBean ( variables .invalidEventHandler );
34- }
35-
3631 // init the security modules dictionary
3732 variables .securityModules = {};
3833
@@ -49,10 +44,7 @@ component accessors="true" extends="coldbox.system.Interceptor" {
4944 setProperty ( " rules" , variables .rulesLoader .loadRules ( getProperties () ) );
5045 }
5146
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.
5648 variables .enableInvalidHandlerCheck = ( listGetAt ( controller .getColdboxSettings ().version , 1 , " ." ) <= 5 );
5749 }
5850
@@ -66,6 +58,10 @@ component accessors="true" extends="coldbox.system.Interceptor" {
6658 prc ,
6759 buffer
6860 ){
61+
62+ // Register the validator
63+ registerValidator ( getInstance ( getProperty ( " validator" ) ) );
64+
6965 // Register cbSecurity modules so we can incorporate them.
7066 controller
7167 .getSetting ( " modules" )
@@ -82,6 +78,12 @@ component accessors="true" extends="coldbox.system.Interceptor" {
8278 // Register Module
8379 registerModule ( arguments .module , arguments .config .settings .cbSecurity );
8480 } );
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+ }
8587 }
8688
8789 /**
@@ -241,14 +243,14 @@ component accessors="true" extends="coldbox.system.Interceptor" {
241243 ){
242244 // Get handler bean for the current event
243245 var handlerBean = variables .handlerService .getHandlerBean ( arguments .event .getCurrentEvent () );
244-
246+
245247 // Are we running Coldbox 5 or older?
246248 // is an onInvalidHandlerBean configured?
247249 // 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 )
252254 ) {
253255 // ColdBox tries to detect invalid event handler loops by keeping
254256 // track of the last invalid event to fire. If that invalid event
@@ -260,7 +262,7 @@ component accessors="true" extends="coldbox.system.Interceptor" {
260262 request ._lastInvalidEvent = variables .invalidEventHandler ;
261263 return ;
262264 }
263-
265+
264266 if ( handlerBean .getHandler () == " " ) {
265267 return ;
266268 }
@@ -555,13 +557,9 @@ component accessors="true" extends="coldbox.system.Interceptor" {
555557 * @return { allow:boolean, type:string(authentication|authorization)}
556558 */
557559 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- }
562560
563561 // Are we securing?
564- if ( isBoolean ( arguments .securedValue ) && ! arguments .securedValue ) {
562+ if ( len ( arguments . securedValue ) && isBoolean ( arguments .securedValue ) && ! arguments .securedValue ) {
565563 return {
566564 " allow" : true ,
567565 " type" : " authentication"
@@ -741,7 +739,7 @@ component accessors="true" extends="coldbox.system.Interceptor" {
741739
742740 return len ( CGI .REMOTE_ADDR ) ? CGI .REMOTE_ADDR : " 127.0.0.1" ;
743741 }
744-
742+
745743 /**
746744 * Returns true of the passed handlerBean matches Coldbox's configured invalid event handler.
747745 *
0 commit comments