All Projects → ldaptools → Ldaptools

ldaptools / Ldaptools

Licence: mit
LdapTools is a feature-rich LDAP library for PHP 5.6+.

Projects that are alternatives of or similar to Ldaptools

ldapconsole
The ldapconsole script allows you to perform custom LDAP requests to a Windows domain.
Stars: ✭ 25 (-86.49%)
Mutual labels:  ldap, active-directory
itops
基于Python + Django的AD\Exchange管理系统
Stars: ✭ 113 (-38.92%)
Mutual labels:  active-directory, exchange
OpenAM
OpenAM is an open access management solution that includes Authentication, SSO, Authorization, Federation, Entitlements and Web Services Security.
Stars: ✭ 476 (+157.3%)
Mutual labels:  ldap, active-directory
aspnet-core-ad-authentication
ASP.NET Core Active Directory authentication use LDAP
Stars: ✭ 21 (-88.65%)
Mutual labels:  ldap, active-directory
Verdaccio Ldap
LDAP auth plugin for verdaccio
Stars: ✭ 39 (-78.92%)
Mutual labels:  ldap, active-directory
Auth
Manage multiple user authentication databases from a central web application
Stars: ✭ 17 (-90.81%)
Mutual labels:  ldap, active-directory
Server-Help
💻 This VSTO Add-In allows the user to ping a list of servers and creates a file for Microsoft Remote Desktop Manager an Excel table. This is used for quickly determining which servers are offline in a list. It is written in 3 different versions as a VSTO Add-In in C# and VB.NET as well as a VBA Add-In.
Stars: ✭ 21 (-88.65%)
Mutual labels:  ldap, active-directory
AD-webmanager
A web interface for administration of Active Directory Domains, made in Python, with focus on easy of use and simplicity.
Stars: ✭ 26 (-85.95%)
Mutual labels:  ldap, active-directory
Multiotp
multiOTP open source strong two factor authentication PHP library, OATH certified, with TOTP, HOTP, Mobile-OTP, YubiKey, SMS, QRcode provisioning, etc.
Stars: ✭ 173 (-6.49%)
Mutual labels:  ldap, active-directory
Eloquent Ldap
A Laravel 5.1 package that first tries to log the user against the internal database if that fails, it tries against the configured LDAP/AD server.
Stars: ✭ 19 (-89.73%)
Mutual labels:  ldap, active-directory
gitlab-ldap-group-sync
Manage your gitlab groups with ldap / active directory
Stars: ✭ 21 (-88.65%)
Mutual labels:  ldap, active-directory
Actionpacks
Public PowerShell script gallery for ScriptRunner.
Stars: ✭ 118 (-36.22%)
Mutual labels:  exchange, active-directory
Linux-Active-Directory-join-script
Active directory Join script for Ubuntu, Debian, CentOS, Linux Mint, Fedora, Kali, Elementary OS and Raspbian with built in failchcheck and debugmode for Ubuntu. "The most advanced and updated AD join script on GITHUB for Linux"
Stars: ✭ 97 (-47.57%)
Mutual labels:  ldap, active-directory
k8s-idm-lab
Kubernetes Identity Management Lab
Stars: ✭ 20 (-89.19%)
Mutual labels:  ldap, active-directory
ldap2json
The ldap2json script allows you to extract the whole LDAP content of a Windows domain into a JSON file.
Stars: ✭ 56 (-69.73%)
Mutual labels:  ldap, active-directory
werther
An Identity Provider for ORY Hydra over LDAP
Stars: ✭ 103 (-44.32%)
Mutual labels:  ldap, active-directory
multiOTPCredentialProvider
multiOTP Credential Provider is a V2 Credential Provider for Windows 7/8/8.1/10/2012(R2)/2016 with options like RDP only and UPN name support
Stars: ✭ 121 (-34.59%)
Mutual labels:  ldap, active-directory
adalanche
Active Directory ACL Visualizer and Explorer - who's really Domain Admin?
Stars: ✭ 862 (+365.95%)
Mutual labels:  ldap, active-directory
Laravel Enterprise Starter Kit
👔 Enterprise Web application starter kit or template using Laravel
Stars: ✭ 356 (+92.43%)
Mutual labels:  ldap, active-directory
Automatedlab
AutomatedLab is a provisioning solution and framework that lets you deploy complex labs on HyperV and Azure with simple PowerShell scripts. It supports all Windows operating systems from 2008 R2 to 2019, some Linux distributions and various products like AD, Exchange, PKI, IIS, etc.
Stars: ✭ 1,194 (+545.41%)
Mutual labels:  exchange, active-directory

LdapTools Build Status AppVeyor Build Status Scrutinizer Code Quality Latest Stable Version


LdapTools is a feature-rich LDAP library for PHP 5.6+. It was designed to be customizable for use with pretty much any directory service, but contains default attribute converters and schemas for Active Directory and OpenLDAP.

Installation

The recommended way to install LdapTools is using Composer:

composer require ldaptools/ldaptools

Getting Started

The easiest way to get started is by creating a YAML config file. See the example config file for basic usage. See the configuration file reference doc for a list of all available options.

Once you have a configuration file defined, you can get up and running by doing the following:

use LdapTools\Configuration;
use LdapTools\LdapManager;

$config = (new Configuration())->load('/path/to/ldap/config.yml');
$ldap = new LdapManager($config);

Searching LDAP

With the LdapManager up and going you can now easily build LDAP queries without having to remember all the special syntax for LDAP filters. All values are also automatically escaped. Check the tutorial for all available methods and the cookbook for more query examples.

use LdapTools\Object\LdapObjectType;

// Get an instance of the query...
$query = $ldap->buildLdapQuery();

// Returns a LdapObjectCollection of all users whose first name 
// starts with 'Foo' and last name is 'Bar' or 'Smith'.
// The result set will also be ordered by state name (ascending).
$users = $query->fromUsers()
    ->where($query->filter()->startsWith('firstName', 'Foo'))
    ->orWhere(['lastName' => 'Bar'])
    ->orWhere(['lastName' => 'Smith'])
    ->orderBy('state')
    ->getLdapQuery()
    ->getResult();

echo "Found ".$users->count()." user(s).";
foreach ($users as $user) {
    echo "User: ".$user->getUsername();
}

// Get all OUs and Containers at the base of the domain, ordered by name.
$results = $ldap->buildLdapQuery()
    ->from(LdapObjectType::OU)
    ->from(LdapObjectType::CONTAINER)
    ->orderBy('name')
    ->setScopeOneLevel()
    ->getLdapQuery()
    ->getResult();

// Get a single LDAP object and select some specific attributes...
$user = $ldap->buildLdapQuery()
    ->select(['upn', 'guid', 'sid', 'passwordLastSet'])
    ->fromUsers()
    ->where(['username' => 'chad'])
    ->getLdapQuery()
    ->getSingleResult();

// Get a single attribute value from a LDAP object...
$guid = $ldap->buildLdapQuery()
    ->select('guid')
    ->fromUsers()
    ->where(['username' => 'chad'])
    ->getLdapQuery()
    ->getSingleScalarResult();
    
// It also supports the concepts of repositories...
$userRepository = $ldap->getRepository('user');

// Find all users whose last name equals Smith.
$users = $userRepository->findByLastName('Smith');

// Get the first user whose username equals 'jsmith'. Returns a `LdapObject`.
$user = $userRepository->findOneByUsername('jsmith');
echo "First name ".$user->getFirstName()." and last name ".$user->getLastName();

See the docs for more information on building LDAP queries.

Modifying LDAP Objects

Modifying LDAP is as easy as searching for the LDAP object as described above, then making changes directly to the object and saving it back to LDAP using the LdapManager.

$user = $ldap->buildLdapQuery()
    ->select(['title', 'mobilePhone', 'disabled'])
    ->fromUsers()
    ->where(['username' => 'jsmith'])
    ->getLdapQuery()
    ->getSingleResult();

// Make some modifications to the user account.
// All these changes are tracked so it knows how to modify the object.
$user->setTitle('CEO');

if ($user->hasMobilePhone()) {
    $user->resetMobilePhone();
}

// Set a field by a property instead...
if ($user->disabled) {
    $user->disabled = false;
}

// Add a value to an attribute...
$user->addOtherIpPhones('#001-5555');
// Add a few values at one time...
$user->addOtherIpPhones('#001-4444', '#001-3333', '#001-2222');

// Now actually save the changes back to LDAP...
try {
    $ldap->persist($user);
} catch (\Exception $e) {
    echo "Error updating user! ".$e->getMessage();
}

See the docs for more information on modifying LDAP objects.

Deleting LDAP Objects

Deleting LDAP objects is a simple matter of searching for the object you want to remove, then passing it to the delete method on the LdapManager:

// Decide they no longer work here and should be deleted?
$user = $userRepository->findOneByUsername('jsmith');

try {
    $ldap->delete($user);
} catch (\Exception $e) {
    echo "Error deleting user! ".$e->getMessage();
}

Creating LDAP Objects

Creating LDAP objects is easily performed by just passing what you want the attributes to be and what container/OU the object should end up in:

$ldapObject = $ldap->createLdapObject();

// Creating a user account (enabled by default)
$ldapObject->createUser()
    ->in('cn=Users,dc=example,dc=local')
    ->with(['username' => 'jsmith', 'password' => '12345'])
    ->execute();

// Create a typical AD global security group...
$ldapObject->createGroup()
    ->in('dc=example,dc=local')
    ->with(['name' => 'Generic Security Group'])
    ->execute();

// Creates a contact user...
$ldapObject->createContact()
    ->in('dc=example,dc=local')
    ->with(['name' => 'Some Guy', 'emailAddress' => '[email protected]'])
    ->execute();

// Creates a computer object...
$ldapObject->createComputer()
    ->in('dc=example,dc=local')
    ->with(['name' => 'MYWOKRSTATION'])
    ->execute();
    
// Creates an OU object...
$ldapObject->createOU()
    ->in('dc=example,dc=local')
    ->with(['name' => 'Employees'])
    ->execute();

See the docs for more information on creating LDAP objects.

Documentation

Browse the docs folder for more information about LdapTools.

TODO

Things that still need to be implemented:

  • Automatic generation of the schema based off of information in LDAP.
  • More work needed on the OpenLDAP schema.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].