OOPhoto: Implementing Security In An Object Oriented Application - Round I

<cffunction
	name="OnSessionStart"
	access="public"
	returntype="void"
	output="false"
	hint="I fire when the session starts or is manually reset.">
 
	<!--- Define the local scope. --->
	<cfset var LOCAL = {} />
 
	<!---
		Store the CFID and CFTOKEN values locally so we don't
		lose them.
	--->
	<cfset LOCAL.CFID = SESSION.CFID />
	<cfset LOCAL.CFTOKEN = SESSION.CFTOKEN />
 
	<!---
		Clear the session in case we are re-initializing rather
		than booting up for the first time.
	--->
	<cfset StructClear( SESSION ) />
 
	<!--- Move the CFID / CFTOKEN back into the session. --->
	<cfset SESSION.CFID = LOCAL.CFID />
	<cfset SESSION.CFTOKEN = LOCAL.CFTOKEN />
 
	<!--- Create a user object in our session. --->
	<cfset SESSION.User = APPLICATION.Factory
		.Get( "SecurityService" )
		.GetUser()
		/>
 
	<!--- Return out. --->
	<cfreturn />
</cffunction>

For Cut-and-Paste