Skip to content

no2key/ActiveDirectory.php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ActiveDirectory.php

User authentication and access control tools for Active Directory

Installation

The recommended way to install Connection.php is through Composer.

{
	"require": {
		"tangervu/activedirectory": "dev-master"
	}
}

Example

<?php
require('vendor/autoload.php'); //Use composer autoload

$ad = new ActiveDirectory\ActiveDirectory();

//Load AD server settings from ini file
$ad->loadConfig('config.ini');

//Identify user. Uses Apache authentication (mod_auth_kerb) as primary authentication method but has http auth as fallback method.
$login = $ad->identify();

//Get dname for user $login
$dname = $ad->getDname($login);

//Get user information
$userInfo = $ad->getInfo($dname);

//Check if user is member of an AD group (recursive search)
if($ad->isMemberOf($dname, "Test Group", true)) {
	$isMember = true;
}
else {
	$isMember = false;
}

License

LGPL v3

About

User authentication using ActiveDirectory

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%