Handle AMF authentication

@param string $userid
@param string $password
@return boolean
195657
protected function _handleAuth( $userid,  $password)
    {
        if (!$this->_auth) {
            return true;
        }
        $this->_auth->setCredentials($userid, $password);
        $auth = Zend_Auth::getInstance();
        $result = $auth->authenticate($this->_auth);
        if ($result->isValid()) {
            if (!$this->isSession()) {
                $this->setSession();
            }
            return true;
        } else {
            // authentication failed, good bye
            require_once 'Zend/Amf/Server/Exception.php';
            throw new Zend_Amf_Server_Exception(
                "Authentication failed: " . join("\n",
                    $result->getMessages()), $result->getCode());
        }

    }
1087338
public function authenticate($username, $password)
    {
        $auth = new AuthenticationService();
        $adapter = new LdapAdapter([$this->config()->options], $username, $password);
        return $auth->authenticate($adapter);
    }
1303993
public void setCredentials(String userid, String password) {
        Map<String, String> data = new HashMap<String, String>();
        data.put("userid", userid);
        data.put("password", password);
        RemotingHeader header = new RemotingHeader(RemotingHeader.CREDENTIALS, true, data);
        headers.put(RemotingHeader.CREDENTIALS, header);
    }
940865
public function authenticate($username, $password) {
        $success = $username == self::VAL_USER && $password == self::VAL_PWD;

        if (!$success) {
            $this->error = new \SlimPower\Authentication\Error();
            return null;
        } else {
            return array('user' => self::VAL_USER);
        }
    }
761506
public function checkUserCredentials($username, $password)
    {
        if ($user = $this->getUser($username)) {
            return $this->checkPassword($user, $password);
        }

        return false;
    }
849428
public function basicAuth($username, $password)
    {
        $this->username = $username;
        $this->password = $password;
        return $this;
    }
882789
public function Authenticate($username, $password)
    {
        // Start authentication
        fputs($this->smtp_conn, "AUTH LOGIN" . $this->CRLF);

        $rply = $this->get_lines();
        $code = substr($rply, 0, 3);

        if ($code != 334) {
            $this->error =
            array("error" => "AUTH not accepted from server",
                "smtp_code"   => $code,
                "smtp_msg"    => substr($rply, 4));
            if ($this->do_debug >= 1) {
                echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
            }
            return false;
        }

        // Send encoded username
        fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);

        $rply = $this->get_lines();
        $code = substr($rply, 0, 3);

        if ($code != 334) {
            $this->error =
            array("error" => "Username not accepted from server",
                "smtp_code"   => $code,
                "smtp_msg"    => substr($rply, 4));
            if ($this->do_debug >= 1) {
                echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
            }
            return false;
        }

        // Send encoded password
        fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);

        $rply = $this->get_lines();
        $code = substr($rply, 0, 3);

        if ($code != 235) {
            $this->error =
            array("error" => "Password not accepted from server",
                "smtp_code"   => $code,
                "smtp_msg"    => substr($rply, 4));
            if ($this->do_debug >= 1) {
                echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
            }
            return false;
        }

        return true;
    }
983226
public function userWithPass($username, $password)
    {
        $header = base64_encode(sprintf('%s:%s', $username, $password));

        $this->headers['Authorization'] = 'Basic ' . $header;
    }
492290
public function checkUserCredentials($username, $password)
    {
        $user = $this->getUserDetails($username);

        return $user && $user['password'] === $password;
    }
1330885
public function amHttpAuthenticated($username, $password)
    {
        $this->client->setServerParameter('PHP_AUTH_USER', $username);
        $this->client->setServerParameter('PHP_AUTH_PW', $password);
    }
1174272
public function login($user, $password)
    {
        return $this->requestAndResponse('LOGIN', $this->escapeString($user, $password), true);
    }
373148
public function updatePassword($username, $password)
    {
        /** @var UserInterface|EloquentUser $user */
        if ( ! ($user = $this->sentinel->findByCredentials(['email' => $username]))) {
            return false;
        }

        return $this->sentinel->update($user, ['password' => $password]) instanceof UserInterface;
    }
402357
public function setPassword($userId, $password)
    {
        $sql = "UPDATE CF_MEMBER SET USER_PASS = hashbytes('sha1', ?) WHERE USN = ?";
        $stmt = $this->getEntityManager()->getConnection()->prepare($sql);
        $stmt->execute([$password, $userId]);

        return $stmt->fetch();
    }
296763
public static function login($username, $password) {
		if ($user = user::find($username, $password)) {
			self::$user           = $user;
			self::$isGuest        = false;
			$_SESSION["username"] = $username;

			return true;
		}

		return false;
	}
632970
public function authenticate($password)
    {
        $packet = $this->createPacket(Packet::SERVERDATA_AUTH, $password);

        $response = $this->sendPacket($packet);

        if ($response->getType() !== Packet::SERVERDATA_AUTH_RESPONSE) {
            throw new Exception\AuthenticationFailed('Invalid packet type returned, SERVERDATA_AUTH_RESPONSE expected');
        }

        if ($response->getId() !== $this->packetId) {
            throw new Exception\AuthenticationFailed('Invalid packet id returned, possibly a badly unpacked -1 (failure)');
        }

        return true;
    }
1238204
public function login($username, $password)
    {
        $data = $this->matrix()->request('POST', $this->endpoint('login'), [
            'type' => 'm.login.password',
            'user' => $username,
            'password' => $password
        ]);
        $this->setData($data);
        return $this->data;
    }
1015129
public static function login($userLogin, $userPassword)
    {
        try {
            $user = self::authenticate($userLogin, $userPassword);
            $loggedIn = self::startSession($user);
        } catch (common_user_auth_AuthFailedException $e) {
            $loggedIn = false;
        }
        return $loggedIn;
    }