LdapTools\Operation\Handler\AuthenticationOperationHandler::execute PHP Метод

execute() публичный Метод

public execute ( LdapTools\Operation\LdapOperationInterface $operation )
$operation LdapTools\Operation\LdapOperationInterface
    public function execute(LdapOperationInterface $operation)
    {
        /** @var AuthenticationOperation $operation */
        $this->dispatcher->dispatch(new LdapAuthenticationEvent(Event::LDAP_AUTHENTICATION_BEFORE, $operation));
        $wasBound = $this->connection->isBound();
        $response = $this->getAuthenticationResponse($operation);
        if ($response->isAuthenticated() && $operation->getSwitchToCredentials()) {
            $this->switchCredentials($operation);
        } elseif ($wasBound) {
            $this->connection->close()->connect();
        } else {
            $this->connection->close();
        }
        $this->dispatcher->dispatch(new LdapAuthenticationEvent(Event::LDAP_AUTHENTICATION_AFTER, $operation, $response));
        return $response;
    }