Solved

Web Intranet Corporate Auto Login using existing user information

Posted on 2009-05-13
5
1,193 Views
Last Modified: 2013-12-19
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.

0
Comment
Question by:stmayes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
webwyzsystems earned 500 total points
ID: 24376140
How about javascript creating an activex? Will that work for you?

<SCRIPT>
var wshshell=new ActiveXObject("wscript.shell");
var username=wshshell.ExpandEnvironmentStrings("%username%");
alert (username);
</SCRIPT>

You'll need to have each workstation adjust their security settings....
0
 

Author Comment

by:stmayes
ID: 24376325
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
0
 

Author Comment

by:stmayes
ID: 24376543
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??
0
 
LVL 10

Expert Comment

by:webwyzsystems
ID: 24378946
Why prompt? IF you are Active directory, then add a policy to trust. See this thread:
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Windows_2003_Active_Directory/Q_22590528.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.
0
 

Author Comment

by:stmayes
ID: 24382712
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??
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question