Welcome to Dream.In.Code
Become an Expert!

Join 136,880 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,737 people online right now. Registration is fast and FREE... Join Now!




Security in Coldfusion Pages

 
Reply to this topicStart new topic

Security in Coldfusion Pages

isheanesu
29 Jul, 2008 - 01:01 PM
Post #1

New D.I.C Head
*

Joined: 29 Jul, 2008
Posts: 1

Hi Guys

I need urgent help with an application that I'm working on in CF 7. I need to build a secure application that will ensure the integrity of all data that is entered by the users.

The user on having a session expire must not be able to use the history(history.back(-1)wink2.gif of the browser to visit the previous pages that they would have been viewing because the session is no longer valid.

below is the code in my application.cfm
CODE

<cfoutput>
<cfset dsname = "dsn">
    <!--- Get the global configuration parameters for the site --->
    <cfquery name="config" datasource="#dsname#">
    SELECT *
    FROM config
    WHERE
    config_id = 1
    </cfquery>
    <cfset mailserver = "#config.mailserver#">
    <cfset fromEmailAddress = "#config.siteEmail#">
    <!---cfset emailUsername = "#config.emailUsername#">
    <cfset emailPassword = "#config.emailPassword#"--->
    <!--- Name our app, and enable Session variables. Session timeout or automatic logout = 10 minutes --->
    <cfapplication name="#datasourcename#" sessionmanagement="Yes" sessiontimeout="#CreateTimeSpan(0,0,10,0)#"
applicationtimeout="#CreateTimeSpan(0,2,0,0)#" >
    <!---If user closes browser end session --->
    <cfif IsDefined("Cookie.CFID") AND IsDefined("Cookie.CFTOKEN")>    
        <cfset cfid_local = Cookie.CFID>    
        <cfset cftoken_local = Cookie.CFTOKEN>    
        <cfcookie name="CFID" value="#cfid_local#">    
        <cfcookie name="CFTOKEN" value="#cftoken_local#">
    </cfif>
    <!--- setup your sessions --->
    <!---commmonly used variables--->
    <cfset today = #createODBCDATE(now())#>
    <cfset todayDate = #dateformat(today, 'm/dd/yyyy')#>
    <cfset weekFromToday = #dateformat(DateAdd("s", 604800, todayDate), 'm/dd/yyyy')#>
    <cfif not isdefined('SESSION.SearchText')>
        <cfset SESSION.SearchText = ''>
    </cfif>
</cfoutput>


Please Help me I have an irate client on my back.
User is offlineProfile CardPM
+Quote Post

wblakenc
RE: Security In Coldfusion Pages
30 Jul, 2008 - 05:09 AM
Post #2

New D.I.C Head
*

Joined: 17 Jul, 2008
Posts: 6



Thanked: 1 times
My Contributions
I had this same need. However I needed it for a secure page I created. On my application.cfc page it has a check to see if the user is logged in, if not sends them to a login page. If they are lets them go on their way.
To address your need not to allow a user to see a cashed page put the following in the document head:

CODE

<cfoutput>
<cfheader name="expires" value="#now()#">
<cfheader name="cache-control" value="no-cache, no-store, must-revalidate">
</cfoutput>


What this should do is not allow a user to use back because after they logout their browser will be required to re-validate the cashed version of the page which will make the Application.cfc check to see if they are logged in. If not, it will redirect them to the login page.

I hope this is what you are looking for.


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 08:33PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month