_password; } /** * Get the username (if set) * * @return string|null */ protected function getUserName() { return $this->_username; } /** * Set authentication result to success for the given user object. * * @param User $user * @return AuthPluginBase */ public function setAuthSuccess(User $user) { $event = $this->getEvent(); $identity = $this->getEvent()->get('identity'); $identity->id = $user->uid; $identity->user = $user; $identity = $this->getEvent()->set('identity', $identity); $event->set('result', new LSAuthResult(self::ERROR_NONE)); return $this; } /** * Set authentication result to failure. * * @param int $code Any of the constants defined in this class * @param string $message An optional message to return about the failure * @return AuthPluginBase */ public function setAuthFailure($code = self::ERROR_UNKNOWN_IDENTITY, $message = '') { $event = $this->getEvent(); $identity = $this->getEvent()->get('identity'); $identity->id = null; $event->set('result', new LSAuthResult($code, $message)); return $this; } /** * Set this plugin to handle the authentication * * @return AuthPluginBase */ public function setAuthPlugin() { $event = $this->getEvent(); $identity = $this->getEvent()->get('identity'); $identity->plugin = get_class($this); $this->getEvent()->stop(); return $this; } /** * Set the password to use for authentication * * @param string $password * @return AuthPluginBase */ protected function setPassword($password) { $this->_password = $password; $event = $this->getEvent(); $identity = $this->getEvent()->get('identity'); $identity->password = $password; $event->set('identity', $identity); return $this; } /** * Set the username to use for authentication * * @param string $username The username * @return AuthPluginBase */ protected function setUsername($username) { $this->_username = $username; $event = $this->getEvent(); $identity = $this->getEvent()->get('identity'); $identity->username = $username; $event->set('identity', $identity); return $this; } }