Entries for month: June 2008

Jon Messer Writes! Check out Amcom Technology Blog's Newest Author

Miscellany , Modeling , ColdFusion No Comments »
Amcom Technology is chock full of serious Coldfusion and Flex talent. Not the least of which is Jon Messer who has long contributed to the many of the popular CF lists. Jon is starting a new series on building an object oriented application with multiple MVC clients including Flex. The first installment introduces the series and describes modeling business objects. If you are interested in OO application design for Coldfusion, I highly recommend this series as a reference.

Dynamic Configuration with Environment Config And a Coldspring Config Factory

Ideas , Configuration , ColdSpring 2 Comments »
When developing web application, it is very likely that at some point you will need to create dynamic configuration for your application in terms of development, staging and production environments. I recently discovered the excellent Environment Config project by Rolando Lopez. Rolando has created a very interesting package with lots of robust features for configuring your application dynamically. There are portions of the package that I must admit, I'm not using (yet). What follows is my current setup for integrating the environment config with a custom factory.

Read more...

Model Glue Event Security Using Broadcasts and Results

Model Glue 8 Comments »
When building web applications, you will inevitably need to provide secure pages or an entire area of your application for users and administrators. For my most recent Model Glue project I wanted to define a common approach to securing all access to the admin area with the exception of login pages. After several failed attempts at universal security, I decided that securing events is best achieved through explicit broadcasts and results, with a minimal amount of logic handled within the controller. Here's a simple example. Let's presume that the default event for my admin sub-application is "admin.home", here is my event listener declaration. <event-handler name="admin.home">
<broadcasts>
<message name="loginRequired" />
</broadcasts>
<results>
<result name="noValidLogin" do="login.go" redirect="true" />
<result do="layout" />
</results>
<views>
<include name="content" template="home.cfm" />
</views>
</event-handler>
The loginRequired has a listener defined by the following. <controller name="SecurityController" type="admin.controller.SecurityController">
<message-listener message="loginRequired" function="verifyLogin" />
</controller>
Finally, in my SecurityController, the verifyLogin method looks like this. <cffunction name="verifyLogin" access="public" returnType="void" output="false">
<cfargument name="event" type="any">
<cfif not getSecurityService().adminLoggedIn()>
<cfset arguments.event.addresult("noValidLogin")>
</cfif>
</cffunction>
In a previous application I chose to use event.forward() within my controller to redirect the request to the login event. Although this works, it is, in my opinion, better to use addResult and have Model Glue handle the redirection. Although the xml is more verbose, I really like that the intent of each event is clearly defined. Which provides a nice roadmap for any other developers that may take over the project.

Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds