/** * Validate a user against the given credentials. * * @param UserContract $user * @param array $credentials * * @throws adLDAP\adLDAPException * * @return bool */ public function validateCredentials(UserContract $user, array $credentials) { $userDN = $this->ad->search(true, $credentials['username']); if (count($userDN) != 0) { $userDN = $userDN[$credentials['username']][3]; return $this->ad->authenticate($userDN, $credentials['password']); } }