?
Solved

Web Intranet Corporate Auto Login using existing user information

Posted on 2009-05-13
5
Medium Priority
?
1,199 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 2000 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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

719 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