setBaseAdapter example

$adapter->setDigestResolver(
            new StaticResolver(
                $this->get(ModelManager::class)
            )
        );

        $adapter->setRequest($this->request);
        $adapter->setResponse($this->response);

        $resource = Shopware_Components_Auth::getInstance();
        $storage = new Zend_Auth_Storage_NonPersistent();
        $resource->setBaseAdapter($adapter);
        $resource->addAdapter($adapter);
        $resource->setStorage($storage);

        return $resource;
    }
}

    public function login($username$password)
    {
        $result = null;
        $adapters = $this->getAdapter();
        foreach ($adapters as $adapter) {
            $adapter->setIdentity($username);
            $adapter->setCredential($password);

            $result = $this->authenticate($adapter);
            if ($result->isValid()) {
                $this->setBaseAdapter($adapter);

                return $result;
            }
        }
        $this->setBaseAdapter(null);

        return $result;
    }

    /** * Set current active adapter * * @param \Zend_Auth_Adapter_Interface|null $adapter * * @return \Shopware_Components_Auth */

    public function onInitResourceAuth(Enlight_Event_EventArgs $args)
    {
        /** @var Enlight_Components_Session_Namespace $session */
        $session = Shopware()->Container()->get('backendsession');

        $resource = Shopware_Components_Auth::getInstance();
        $adapter = new Shopware_Components_Auth_Adapter_Default($session);
        $storage = new Zend_Auth_Storage_Session($session);
        $resource->setBaseAdapter($adapter);
        $resource->addAdapter($adapter);
        $resource->setStorage($storage);

        $this->registerAclPlugin($resource);

        return $resource;
    }

    public function getCapabilities()
    {
        return [
            
Home | Imprint | This part of the site doesn't use cookies.