Ldap
in package
Ldap manages connection to LDAP and includes several helper functions.
Table of Contents
- $conf : LAMConfig|null
- Object of Config to access preferences
- $is_connected : bool
- LDAP connection established
- $isActiveDirectory : bool|null
- is Active Directory
- $password : string|null
- LDAP password used for bind
- $server : Connection|null
- Server handle
- $username : string|null
- LDAP username used for bind
- __construct() : mixed
- Creates a new LDAP object.
- __serialize() : array<string, string|\LAMConfig|bool>
- Closes the connection to LDAP server before serialization.
- __unserialize() : void
- Reconnects to the LDAP server when deserialized.
- close() : void
- Closes connection to server
- connect() : void
- Connects to the server using the given username and password
- destroy() : void
- Closes connection to LDAP server and deletes encrypted username/password
- encrypt_login() : void
- Encrypts username and password
- getPassword() : string|null
- Returns the LDAP password.
- getUserName() : string|null
- Returns the LDAP username.
- isActiveDirectory() : bool
- Returns if the LDAP server is an Active Directory.
- server() : Connection|null
- Returns the LDAP connection handle
- tryAndApplyNewPassword() : void
- Checks if the given password is the new password to use for the current user.
Properties
$conf
Object of Config to access preferences
private
LAMConfig|null
$conf
= \null
$is_connected
LDAP connection established
private
bool
$is_connected
= \false
$isActiveDirectory
is Active Directory
private
bool|null
$isActiveDirectory
= \null
$password
LDAP password used for bind
private
string|null
$password
= \null
$server
Server handle
private
Connection|null
$server
= \null
$username
LDAP username used for bind
private
string|null
$username
= \null
Methods
__construct()
Creates a new LDAP object.
public
__construct(LAMConfig|null $config) : mixed
Parameters
- $config : LAMConfig|null
-
configuration
Return values
mixed —__serialize()
Closes the connection to LDAP server before serialization.
public
__serialize() : array<string, string|\LAMConfig|bool>
Return values
array<string, string|\LAMConfig|bool> —data
__unserialize()
Reconnects to the LDAP server when deserialized.
public
__unserialize(array<string, string|\LAMConfig|bool> $data) : void
Parameters
- $data : array<string, string|\LAMConfig|bool>
-
data
Return values
void —close()
Closes connection to server
public
close() : void
Return values
void —connect()
Connects to the server using the given username and password
public
connect(string|null $user, string|null $passwd[, bool $allowAnonymous = false ]) : void
Parameters
- $user : string|null
-
user name
- $passwd : string|null
-
password
- $allowAnonymous : bool = false
-
specifies if anonymous binds are allowed
Tags
Return values
void —destroy()
Closes connection to LDAP server and deletes encrypted username/password
public
destroy() : void
Return values
void —encrypt_login()
Encrypts username and password
public
encrypt_login(string $username, string $password) : void
Parameters
- $username : string
-
LDAP user name
- $password : string
-
LDAP password
Return values
void —getPassword()
Returns the LDAP password.
public
getPassword() : string|null
Return values
string|null —password
getUserName()
Returns the LDAP username.
public
getUserName() : string|null
Return values
string|null —user name
isActiveDirectory()
Returns if the LDAP server is an Active Directory.
public
isActiveDirectory() : bool
Return values
bool —is Active Directory
server()
Returns the LDAP connection handle
public
server() : Connection|null
Return values
Connection|null —connection handle
tryAndApplyNewPassword()
Checks if the given password is the new password to use for the current user.
public
tryAndApplyNewPassword(string $newPassword) : void
Parameters
- $newPassword : string
-
new password