serverUrl
serverUrl
A simple abstract layer to use ldap in order to manage 42 authentications.
__construct(array $dn, string $password)
Will construct a new Auth42 object, wich is a ldap based search and authentication tool.
array | $dn | the dn to use. If no dn is provided, will use ou=2013,ou=people,dc=42,dc=fr as the default dn. |
string | $password | an optionnal password to connect with. |
search(string $query, string $login, string $password, string $filter) : array
Will try to search the given query on the ldap.
if a login and a password are supplied, will try to bind the ldap with theses id before the request. On failure, will throw an Auth42Exception. If no filter is supplied, the default filter ("dc=42,dc=fr") is applied.
string | $query | the query to execute, like 'uid=a*'. |
string | $login | an optionnal login to bind the server. |
string | $password | an optionnal password to bind the server. |
string | $filter | a filter to apply on the search request. Default: "dc=42,dc=fr". |
when the auth fail.
the search result(s), or false on failure.
authenticate(string $login, string $password) : boolean
Will try to authenticate the user on the 42 ldap with the given password and username.
string | $login | the login (uid) of the student |
string | $password | the password of the student |
true on success, false otherwise.
addOrReplaceDn(string $key, string|array $value)
Will add (or replace) the value of the given key with the given (new) value(s). If there is more than one value to add, use an array instead of a string.
string | $key | the key to add / replace. |
string|array | $value | the value(s) to add. |