Overriding Interterceptor based on Route

Hi folks,

I have several routes in an REST API which require security, and a handful of other routes in the same API that are open.
I’m wondering if there is an elegant way to override the Security interceptor based on the incoming route.

Currently I’m doing a simple check on the route/event:

if(reFindNocase(“createUser”,event.getCurrentAction()) OR reFindNocase(“index”,event.getCurrentAction())){

//don’t do security
}else{
//do security check
}

This is a slimmed down example and there are many more routes which do not need the security. Is there a more elegant way to do this by using regex or an XML config file?

Thanks.

Nolan

Where are you doing security? Are you using an interceptor?

Yes. I’m using a security interceptor.

Thanks.

Nolan

well, if you are using preProcess()

Then you can actually add an annotation to the method called “eventPattern” which is a regex. If the regex matches, then the framework process the function, else skips it.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com