public function sign($username, $password, Adapter\AdapterInterface $adapter = null, Request $request = null)
    {
        /** @var Adapter\AdapterInterface $adapter */
        /** @noinspection CallableParameterUseCaseInTypeContextInspection */
        $adapter = $adapter ?: $this->getAdapter();

        $adapter->setIdentity($username);
        $adapter->setCredential($password);

        return $this->authenticate($adapter, $request);
    }