Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame^] | 1 | <?php |
| 2 | |
| 3 | namespace Adldap\Auth; |
| 4 | |
| 5 | use Adldap\Connections\ConnectionInterface; |
| 6 | use Adldap\Configuration\DomainConfiguration; |
| 7 | |
| 8 | interface GuardInterface |
| 9 | { |
| 10 | /** |
| 11 | * Constructor. |
| 12 | * |
| 13 | * @param ConnectionInterface $connection |
| 14 | * @param DomainConfiguration $configuration |
| 15 | */ |
| 16 | public function __construct(ConnectionInterface $connection, DomainConfiguration $configuration); |
| 17 | |
| 18 | /** |
| 19 | * Authenticates a user using the specified credentials. |
| 20 | * |
| 21 | * @param string $username The users LDAP username. |
| 22 | * @param string $password The users LDAP password. |
| 23 | * @param bool $bindAsUser Whether or not to bind as the user. |
| 24 | * |
| 25 | * @throws \Adldap\Auth\BindException When re-binding to your LDAP server fails. |
| 26 | * @throws \Adldap\Auth\UsernameRequiredException When username is empty. |
| 27 | * @throws \Adldap\Auth\PasswordRequiredException When password is empty. |
| 28 | * |
| 29 | * @return bool |
| 30 | */ |
| 31 | public function attempt($username, $password, $bindAsUser = false); |
| 32 | |
| 33 | /** |
| 34 | * Binds to the current connection using the inserted credentials. |
| 35 | * |
| 36 | * @param string|null $username |
| 37 | * @param string|null $password |
| 38 | * |
| 39 | * @throws \Adldap\Auth\BindException If binding to the LDAP server fails. |
| 40 | * @throws \Adldap\Connections\ConnectionException If upgrading the connection to TLS fails |
| 41 | * |
| 42 | * @return void |
| 43 | */ |
| 44 | public function bind($username = null, $password = null); |
| 45 | |
| 46 | /** |
| 47 | * Binds to the current LDAP server using the |
| 48 | * configuration administrator credentials. |
| 49 | * |
| 50 | * @throws \Adldap\Auth\BindException When binding as your administrator account fails. |
| 51 | * |
| 52 | * @return void |
| 53 | */ |
| 54 | public function bindAsAdministrator(); |
| 55 | } |