Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Login function with CF

"Single sign on" using windows authentication by TruthInSatire
Posted: 18 Apr 05 (Edited 3 Nov 09)

If you are on an intranet wich requires you to log in, you can use cgi variables to log your user in without having to enter a second username and password.

All of this goes right into your Application.cfm file.


<!--- first step is to enable session management (20 minutes) --->

<cfapplication name = "appName" sessionmanagement = "yes" setclientcookies = "yes" sessiontimeout = "#createtimespan(0,0,20,0)#">

<!--- When an invalid user tries to gain access we have to send them to a page that says they do not have access.  This cfif will make sure the login code is not run on "invalidUser.cfm", or we would get stuck in a loop.  we also check for a session variable called "session.loggedin" to keep this from running every time a valid user requests a page.  it will only run if the session does not exists or is false. --->

<cfif not findNoCase("invalidUser.cfm", cgi.SCRIPT_NAME) AND(not isdefined("session.loggedin") OR session.loggedin eq false)>

<!--- Now we get the user.  I prefer not to save the domain name into the database so I remove it.  If you want to save the domain name in the database you don't have to remove it here. cgi.remote_user stores a value similar to domainName\userName. I will use listLast to get the username after the \  --->

<cfset user = listLast(cgi.REMOTE_USER,"\") >

<!--- now we run the query to find the user. "networkID" is where the users nt login name is stored --->

<cfquery name="qLogin" datasource="dsn">
  SELECT networkID
  FROM usersTable
  WHERE networkID = '#user#'

<!--- now we check to see if the user was found in the database --->

<cfif qLogin.recordCount>

<!--- Set session variables --->

<cfset session.networkID = qlogin.networkID>
<cfset session.loggedin = true>

<!--- if the user is not found send them to the invalid user page --->

<cflocation url = "invalidUser.cfm" addtolken = "no">

<!--- if the user was not redirected the rest of the page will continue from here. --->

Back to Adobe FAQ Index
Back to Adobe Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close