Connect flex / php to Active Directory

Is there a way to connect my flexible web application to Active Directory and get a registered username?

Right now we have a PHP script connected to the Flex application that receives the user / password from the user and checks if there is such a user in AD and that the password is correct.
I don't want to ask for a user / password, but for the application to get the domain username connected to it, so I could use it (check if the user has access to my application, etc.).

Is there any way to do this?

+6
flex php active-directory
source share
1 answer
<?php // using ldap bind $ldaprdn = 'uname'; // ldap rdn or dn $ldappass = 'password'; // associated password // connect to ldap server $ldapconn = ldap_connect("ldap.example.com") or die("Could not connect to LDAP server."); if ($ldapconn) { // binding to ldap server $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass); // verify binding if ($ldapbind) { echo "LDAP bind successful..."; } else { echo "LDAP bind failed..."; } } ?> 

When your application is running, you need to access LDAP with Windows login credentials.

 `AUTH_USER` request variable is the one which you have to check. This will hold your Windows login username and AUTH_USER will be MYDOMAINNAME\user.name 

Is the username / password that I need for this an administrator credentials or any user on the system?

You can get the username yourself, not the password ... when the user logs into his windowed machine, we can verify his credentials using Environment.username in C #, and in PHP we can use AUTH_USER to verify that the user's login to the system is valid .

Plus, do you know where I can find a list of variables (e.g. auth_user) what information can I get?

http://in3.php.net/manual/en/ref.ldap.php

You can get a lot of information from the link above.

+3
source share

All Articles