/**
  * {@inheritDoc}
  */
 public function createService(ServiceLocatorInterface $plugins)
 {
     $serviceLocator = $plugins->getServiceLocator();
     $controllerPlugin = new ZfcUserAuthentication();
     $controllerPlugin->setAuthService($serviceLocator->get('zfcuser_auth_service'));
     $controllerPlugin->setAuthAdapter($serviceLocator->get('ZfcUser\\Authentication\\Adapter\\AdapterChain'));
     return $controllerPlugin;
 }
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceManager
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceManager)
 {
     $serviceLocator = $serviceManager->getServiceLocator();
     $authService = $serviceLocator->get('zfcuser_auth_service');
     $authAdapter = $serviceLocator->get('ZfcUser\\Authentication\\Adapter\\AdapterChain');
     $controllerPlugin = new Controller\Plugin\ZfcUserAuthentication();
     $controllerPlugin->setAuthService($authService);
     $controllerPlugin->setAuthAdapter($authAdapter);
     return $controllerPlugin;
 }
예제 #3
0
 public function getControllerPluginConfig()
 {
     return array('factories' => array('zfcUserAuthentication' => function ($sm) {
         $serviceLocator = $sm->getServiceLocator();
         $authService = $serviceLocator->get('zfcuser_auth_service');
         $authAdapter = $serviceLocator->get('ZfcUser\\Authentication\\Adapter\\AdapterChain');
         $controllerPlugin = new Controller\Plugin\ZfcUserAuthentication();
         $controllerPlugin->setAuthService($authService);
         $controllerPlugin->setAuthAdapter($authAdapter);
         return $controllerPlugin;
     }));
 }
 /**
  * {@inheritDoc}
  */
 public function createService(ServiceLocatorInterface $pluginManager)
 {
     /* @var $pluginManager PluginManager */
     $serviceManager = $pluginManager->getServiceLocator();
     /* @var $authService AuthenticationService */
     $authService = $serviceManager->get('zfcuser_auth_service');
     /* @var $authAdapter Adapter\AdapterChain */
     $authAdapter = $serviceManager->get('ZfcUser\\Authentication\\Adapter\\AdapterChain');
     $controllerPlugin = new ZfcUserAuthentication();
     $controllerPlugin->setAuthService($authService)->setAuthAdapter($authAdapter);
     return $controllerPlugin;
 }
 /**
  * @covers ZfcUser\Controller\Plugin\ZfcUserAuthentication::setAuthService
  * @covers ZfcUser\Controller\Plugin\ZfcUserAuthentication::getAuthService
  */
 public function testSetAndGetAuthService()
 {
     $service1 = new AuthenticationService();
     $service2 = new AuthenticationService();
     $this->SUT->setAuthService($service1);
     $this->assertInstanceOf('\\Zend\\Authentication\\AuthenticationService', $this->SUT->getAuthService());
     $this->assertSame($service1, $this->SUT->getAuthService());
     $this->SUT->setAuthService($service2);
     $this->assertInstanceOf('\\Zend\\Authentication\\AuthenticationService', $this->SUT->getAuthService());
     $this->assertNotSame($service1, $this->SUT->getAuthService());
     $this->assertSame($service2, $this->SUT->getAuthService());
 }