コード例 #1
0
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $config = $container->get('Recurly\\ModuleConfig');
     $authConfig = $config['notification']['security']['authentication']['auth_adapter'];
     $authAdapter = new AuthAdapter($authConfig['config']);
     $basicResolver = new FileResolver();
     $basicResolver->setFile($authConfig['passwd_file']);
     $authAdapter->setBasicResolver($basicResolver);
     return $authAdapter;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function createService(ServiceLocatorInterface $digestServiceLocator)
 {
     if (empty($this->digestConfig)) {
         $this->digestConfig = $digestServiceLocator->get('Config');
     }
     $authDigestConfig = $this->digestConfig['authentication_digest']['adapter'];
     $authDigestAdapter = new HttpAdapter($authDigestConfig['config']);
     $digest = new FileResolver();
     $digest->setFile($authDigestConfig['digest']);
     $authDigestAdapter->setDigestResolver($digest);
     return $authDigestAdapter;
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function createService(ServiceLocatorInterface $basicServiceLocator)
 {
     if (empty($this->basicConfig)) {
         $this->basicConfig = $basicServiceLocator->get('Config');
     }
     $authBasicConfig = $this->basicConfig['authentication_basic']['adapter'];
     $authBasicAdapter = new HttpAdapter($authBasicConfig['config']);
     $basic = new FileResolver();
     $basic->setFile($authBasicConfig['basic']);
     $authBasicAdapter->setBasicResolver($basic);
     return $authBasicAdapter;
 }
 /**
  * Genrate Authentication Adapter Object
  * @param ServiceLocatorInterface $serviceLocator service manager 
  * @return \Zend\Authentication\Adapter\Http
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('config');
     $authConfig = $config['book_app']['auth_adapter'];
     $basicResolver = new FileResolver();
     $basicResolver->setFile($authConfig['basic_passwd_file']);
     $digestResolver = new FileResolver();
     $digestResolver->setFile($authConfig['digest_passwd_file']);
     $authAdapter = new HttpAdapter($authConfig['config']);
     $authAdapter->setBasicResolver($basicResolver);
     $authAdapter->setDigestResolver($digestResolver);
     return $authAdapter;
 }
コード例 #5
0
 /**
  * Ensures that __construct() works as expected for valid input
  *
  * @return void
  */
 public function testConstructValid()
 {
     $v = new Http\FileResolver($this->_validPath);
     $this->assertEquals($this->_validPath, $v->getFile());
 }
コード例 #6
0
 protected function getAuthService()
 {
     $config = array('accept_schemes' => 'basic', 'realm' => 'ref-pays-admin');
     //        if (null == $this->authService){
     $httpAuthAdapter = new Http($config);
     $authService = new AuthenticationService();
     $basicResolver = new FileResolver();
     $basicResolver->setFile(dirname(dirname(dirname(dirname(dirname(__DIR__))))) . '\\public\\files\\basicPasswd.txt');
     $httpAuthAdapter->setBasicResolver($basicResolver);
     $httpAuthAdapter->setRequest($this->getRequest());
     $httpAuthAdapter->setResponse($this->getResponse());
     $result = $httpAuthAdapter->authenticate();
     if (!$result->isValid()) {
         die(var_dump($result->getMessages()));
     }
     die('654645');
     $authService->setAdapter($httpAuthAdapter);
     $this->authService = $authService;
     //        }
     return $this->authService;
 }
コード例 #7
0
ファイル: FileResolverTest.php プロジェクト: pnaq57/zf2demo
 /**
  * Ensures that resolve() works as expected when provided nonexistent user
  *
  * @return void
  */
 public function testResolveUserNonexistent()
 {
     $this->assertFalse($this->_resolver->resolve('nonexistent', 'Test Realm'), 'Accepted a nonexistent user from an existing realm');
 }