/** * Identify * * We are authoritative and so we stop event propagation as we have fully identified the user * * @param Event $event * @return int */ public function discern(Event $event) { if (session_status() === PHP_SESSION_ACTIVE && $event instanceof Identify && isset($_SESSION[$this->namespace]['identity'])) { $event->identity()->setIdentified($_SESSION[$this->namespace]['identity']); $event->stopPropagation(); } }
/** * Handles setting the error on the credentials * * @param Event $event * @param int $code * @param string $message * @return void */ private function setErrorOnEvent(Event $event, $code, $message) { if ($this->breakChainOnFailure) { $event->stopPropagation(); } $event->triggerError($code, "[{$this->name}] {$message}"); return; }
/** * Handles setting the error on the credentials * * Returns STATUS_ERROR unless BreakChainOnFailure is set * * @param $ldap * @param Event $event * @param int $code * @param string $message * @return int */ private function setErrorOnEvent($ldap, $event, $code, $message) { if ($this->breakChainOnFailure) { $event->stopPropagation(); } $event->triggerError($code, "[{$this->name}] {$message}"); if (is_resource($ldap)) { ldap_unbind($ldap); } }