So I just came across another issue with my new module. I was trying to set the security interceptor in the module
component {
// Module Properties
this.title = “Solitary”;
this.author = “Daniel Vega”;
this.webURL = “http://www.danvega.org”;
this.description = “A Security Module”;
this.version = “1.0”;
// If true, looks for views in the parent first, if not found, then in the module. Else vice-versa
this.viewParentLookup = true;
// If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa
this.layoutParentLookup = true;
// Module Entry Point
this.entryPoint = “security”;
function configure(){
// parent settings
parentSettings = {
};
// module settings - stored in modules.name.settings
settings = {
};
// Layout Settings
layoutSettings = {
defaultLayout = “”
};
// datasources
datasources = {
};
// web services
webservices = {
};
// SES Routes
routes = [
{pattern="/", handler=“security”,action=“index”},
{pattern="/login", handler=“security”,action=“login”},
{pattern="/logout", handler=“security”,action=“logout”}
];
// Custom Declared Points
interceptorSettings = {
customInterceptionPoints = “”
};
// Custom Declared Interceptors
interceptors = [
//security
{class=“coldbox.system.interceptors.security”,
properties={
rulesSource=“xml”,
rulesFile="/solitary/config/securityRules.xml.cfm",
debugMode=“true”,
preEventSecurity=“true”,
validatorModel=“securityService”
}
}
];
// wirebox mappings
binder.map(“SecurityService”)
.to(“solitary.model.security.SecurityService”)
.asSingleton();
binder.map(“UserService”)
.to(“solitary.model.users.UserService”)
.asSingleton();
}
/**
- Fired when the module is registered and activated.
*/
public void function onLoad(){
// if debug mode make sure we have an admin user
}
/**
- Fired when the module is unregistered and unloaded
*/
public void function onUnload(){
}
}
this was not working, it would find the rules source but the rules never got loaded properly. I did a dump of the rules in the security interceptors pre process function and they were empty. I added the following code to {project_root}/config/Coldbox.cfc and everything worked fine.
//Register interceptors as an array, we need order
interceptors = [
//Autowire
{class=“coldbox.system.interceptors.Autowire”,
properties={}
},
//SES
{class=“coldbox.system.interceptors.SES”,
properties={}
},
//security
{class=“coldbox.system.interceptors.security”,
properties={
rulesSource=“xml”,
rulesFile="/solitary/config/securityRules.xml.cfm",
debugMode=“true”,
preEventSecurity=“true”,
validatorModel=“securityService”
}
}
];
I will do some more debugging on my end but before I do I just wanted to throw this out there. Am I doing something wrong?