Link to home
Start Free TrialLog in
Avatar of VicOm
VicOm

asked on

How to authenticate intranet users

Hi
I need to retrieve an ADS attribute for the currently
logged on user from an asp page, to authenticate who they are.

Using
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.UserName
strADsPath = "LDAP://" & strUserDN
Set objADs = GetObject(strADsPath)
x = objADS.<attribute>

Returns the attribute of the anonymous internet account,
but I need to return the attribute of the ADS
authenticated user when the site is accessed via the
Intranet.
Thought it would be simple, but cannot find any info on
how to do this.
Creating a dll also returns the anonymous internet account attributes, as it also is generated from the same calling thread as the asp code.

Thanks in advance
VicOm
Avatar of pjknibbs
pjknibbs

As far as I know you can get the username of the currently authenticated user (assuming you've set your Intranet to require authentication) by simply retrieving the server variable LOGON_USER (e.g. Request.ServerVariables("LOGON_USER")). Assuming you've disabled Anonymous access to the Intranet then the user should already be authenticated by the time this code is called, so that should be all you need to do.
Avatar of VicOm

ASKER

Unfortunately I still need to allow anonymous access which prevents me using this method.
The idea is to log an authenticated (via ADS) intranet user directly into the site, without them having to input a username/password, but force all other (anonymous) users to login through a standard web form log-in page.
ASKER CERTIFIED SOLUTION
Avatar of pjknibbs
pjknibbs

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of VicOm

ASKER

I have created an exe that the users will run that extracts the authenticated user info from ADS, encrypts it and then launches the browser, passing this data along with it.
Thanks for the help.