PHP code example of surda / adldap2-nette
1. Go to this page and download the library: Download surda/adldap2-nette library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
surda / adldap2-nette example snippets
use Adldap\Adldap;
use Adldap\Auth\BindException;
use Adldap\Auth\PasswordRequiredException;
use Adldap\Auth\UsernameRequiredException;
class Foo
{
public function __construct(private Adldap $adldap)
{
}
public function auth(): bool
{
$provider = $this->adldap->connect();
try {
return $provider->auth()->attempt('username', 'password');
}
catch (BindException $e) {
}
catch (PasswordRequiredException $e) {
}
catch (UsernameRequiredException $e) {
}
}
}