im currently working on a hybrid application for my company that requires employee authentication via LDAP / ActiveDirectory
in PHP its not that hard to authorizes against LDAP.
Your PHP Configuration should have session and ldap enabled.
heres an example of a basic auth with PHP
class LDAP_Authentication
{
private $connection;
public function __construct($domain)
{
$this->connection = @ldap_connect($domain);
}
public connected()
{
return $this->connection !== false;
}
public function login($user,$password)
{
return @ldap_bind($this->connection,$user,$password);
}
}
Example of usage:
session_start(); //Single Login
$LDAPAuth = new LDAP_Authentication('domain.internal');
if($LDAPAuth->connected())
{
if($LDAPAuth->login('some_user',"some_pass"))
{
$_SESSION['logged_in'] = true;
$_SESSION['credentials'] = array('some_user','some_pass');
echo 'Welcome';
}else
{
echo 'Try again';
}
}
Update 1
A possible method is using JavaScript to accomplish this, you can detect the clients computer name, user name, domain by using the network object in WScript, you then detect the credentials and then send them to the server to check with AD, if there all good the server then will create a session for that user and reply with an JSON Object, with success set to true.
the javascript side will then see that its a success and then redirect the browser to another location causing them to be logged in.
POC:
var Data = {}
//Show loading layer
$("#loader").show();
try
{
var Information = new ActiveXObject("WScript.Network");
Data.Username = Information.UserName;
Data.Computername = Information.ComputerName;
Data.Domain = Information.UserDomain;
$.post("/ldap/ajax/login",Data,fucntion(object){
if(object.success)
{
document.location = "/"; //Will automatically start session.
}else
{
document.location = "/ldap/faild/"; //general login page
}
});
}catch(e)
{
document.location = "/ldap/faild/"; //general login page
}