Link to home
Start Free TrialLog in
Avatar of stmayes
stmayesFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Web Intranet Corporate Auto Login using existing user information

I am building an intranet for a client using Apache, PHP and Zend Framework. They have a corporate network with roaming profiles and active directory. The intranet will only be accessible from inside the network and not externally. They use IE7 only.

What they want is to automatically authenticate by knowing the current user. They do not want to have to log in a second time.

I know I can query the LDAP Active Directory server and authenticate with the same username and password but they specifically do not want to log in again.

I do not think this is possible, how can a PHP script know what the current user is? Hopefully someone can tell me different.

Is there some Active X module that will add the username to the $_SERVER or similar? All I need to get to authorise is the username because the site is only accessible internally and everyone that access the http server has to be logged on and authenticated with the network.

Any ideas?

If all else fails I will authenticate with the LDAP server and just have a cookie but if I could do it it would be awesome.

Thanks.

ASKER CERTIFIED SOLUTION
Avatar of webwyzsystems
webwyzsystems

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 stmayes

ASKER

I thought that this sort of functionality was available but I have never explored it. Can you comment more? I tried the attached code in IE6 and it just bugged out (I don't think the object is being created) and did nothing. Can you suggest any threads or online resources for me? I have no experience on Windows and come from a Mac and *nix background.

Thanks
Avatar of stmayes

ASKER

Just disabled all security and got the JS to work. What is the minimum security required how do I prompt to "trust" the site? I can get their sys admin to add the site the roaming profiles.

Can anyone see this as a security problem? If I was to do an ajax request on the site home page posting the username to my script for authentication? I would like to limit my script and say it must be refered via my homepage to prefent hacking using the $_SERVER['HTTP_REFERER']. However I know that his can be hacked very easily.

Can anyone suggest an improvement to this model??
Avatar of webwyzsystems
webwyzsystems

Why prompt? IF you are Active directory, then add a policy to trust. See this thread:
https://www.experts-exchange.com/questions/22590528/Active-Directory-GPO-to-add-trusted-sites-for-all-users.html

IMPROVEMENTS
Your primary risk will be from a "trusted" user, who injects his own values for the javascript - perhaps by frame or iframe injection.
A home page redirect might be an idea. When they pull up your home page, it would go to a page, get the logged in username silently, then redirect to your "real" home page. On this page, you can also trap for failure, referrer, whatever you wish. If username is undefined then popup an alert saying "This page needs to be added to your trusted sites zone.".

And of course its always a good idea to use php sessions on your site, rather than passing sensive variables with POST or GET.
Avatar of stmayes

ASKER

Thanks.

Re "Why Post?": I'd have to make the POST once to get the var from the JS into the PHP and then I would then use Zend_Auth, Zend_Acl & Zend_Session to manage access control from then on.

If I have a blank home page with only an  AJAX (jQuery) call:
$('#myDiv').load('/auth/login/', {'username': username, 'type': 'renderHomepage'});

Then on '/auth/login' do the authentication and return a response.

Also for added security (albeit it is easy to hack), in order to excute '/auth/login', the $_SERVER['HTTP_REFERER'] must be '/auth/login'.

Is this solution still exposed to any code injection??