Windows Authentication and ColdFusion

2006-05-16 00:17:00.0

Windows Authentication and ColdFusion

Recently a project came up where we had to integrate user login information in our database with the users Windows Authentication on the network.

Peter did a great job of implementing this using the very handy CGI variable : #cgi.auth_user#

When a person logs in using WindowsNT authentication, ColdFusion passes the users login name in the variable cgi.auth_user

Peter kept a field in the users database called usersNetworkLogin and if the users session data was 0, he looked up the database against this variable. If a user was matched, he set the user logged in with session.loggedInUserId set to the users actual id from the database.

To save a dbs lookup in the future he set a cookie on the users machine.

This is a small bit of code and logic but has helped us out enormously on the Intranet project we were working on.......

Add to your    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [3] - Leave a comment


chas randal said:
I have an Intranet using IIS and CFMX. When I turned off Anonymous Login, I get the user name in #cgi.auth_user# just like I need, but now my scheduled tasks won't run! How do I set them to run with Integrated windows authentication enabled?
Eric Knipp said:
Chas -

your best bet is to ensure that automated processes are hitting directories not secured with integrated authentication. You can easily make one or more subdirectories anonymous and put your automated stuff in there.


alex Pena said:
What if your site is not running IIS, but Apache. How can I capture the Windows login user id?