当前位置: 首页>>代码示例>>PHP>>正文


PHP AuthenticationService::setAdapter方法代码示例

本文整理汇总了PHP中Zend\Authentication\AuthenticationService::setAdapter方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthenticationService::setAdapter方法的具体用法?PHP AuthenticationService::setAdapter怎么用?PHP AuthenticationService::setAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Authentication\AuthenticationService的用法示例。


在下文中一共展示了AuthenticationService::setAdapter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getServiceConfig

 public function getServiceConfig()
 {
     return array('factories' => array('Album\\Model\\AlbumTable' => function ($sm) {
         $tableGateway = $sm->get('AlbumTableGateway');
         $table = new AlbumTable($tableGateway);
         return $table;
     }, 'AlbumTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Album());
         return new TableGateway('z_album', $dbAdapter, null, $resultSetPrototype);
     }, 'Album\\Model\\MyAuthStorage' => function ($sm) {
         return new \Album\Model\MyAuthStorage('Album');
     }, 'AuthService' => function ($sm) {
         //My assumption, you've alredy set dbAdapter
         //and has users table with columns : user_name and pass_word
         //that password hashed with md5
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'z_user', 'user_name', 'password', "sha(CONCAT(sha(?), '{$this->_salt}'))");
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         $authService->setStorage($sm->get('Album\\Model\\MyAuthStorage'));
         return $authService;
     }));
 }
开发者ID:Embraser01,项目名称:IUT-ProjetWeb-TP1,代码行数:25,代码来源:Module.php

示例2: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $adapter = $serviceLocator->get('auth-adapter');
     $auth = new AuthenticationService();
     $auth->setAdapter($adapter);
     return $auth;
 }
开发者ID:spoorey,项目名称:hangman,代码行数:7,代码来源:AuthenticationFactory.php

示例3: getServiceConfig

 public function getServiceConfig()
 {
     return array('factories' => array('Common\\HttpApi\\SmsApi' => function ($sm) {
         $curlAdapter = new Curl();
         return new \Common\HttpApi\SmsApi($curlAdapter);
     }, 'Zend\\Log' => function ($sm) {
         $config = $sm->get('Config');
         $log = new \Zend\Log\Logger();
         $writer = new \Zend\Log\Writer\Stream('./' . $config['logger']['path']);
         $log->addWriter($writer);
         $filter = new \Zend\Log\Filter\Priority($config['logger']['priority']);
         $writer->addFilter($filter);
         return $log;
     }, 'Common\\Authentication\\Adapter' => function ($sm) {
         $em = $sm->get('doctrine.entitymanager.orm_default');
         $adapter = new \Common\Authentication\DoctrineAdapter($em);
         return $adapter;
     }, 'Common\\Authentication\\Service' => function ($sm) {
         $service = new AuthenticationService();
         $authAdapter = $sm->get('Common\\Authentication\\Adapter');
         $service->setAdapter($authAdapter);
         return $service;
     }, 'Common\\Authentication\\BjyAuthorizeIdentityProvider' => function ($sm) {
         $authService = $sm->get('Common\\Authentication\\Service');
         return new \Common\Authentication\BjyAuthorizeIdentityProvider($authService);
     }));
 }
开发者ID:zhangyuxiao,项目名称:qoros,代码行数:27,代码来源:Module.php

示例4: authenticate

 public function authenticate(array $credentials)
 {
     $username = $credentials['username'];
     $password = $credentials['password'];
     $dbAdapter = $this->serviceManager->get('Zend\\Db\\Adapter\\Adapter');
     $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'users', 'username', 'password', 'MD5(?)');
     $dbTableAuthAdapter->setIdentity($username);
     $dbTableAuthAdapter->setCredential($password);
     $authService = new AuthenticationService();
     $authService->setAdapter($dbTableAuthAdapter);
     //$authService->setStorage($this->getServiceManager()->get('IdAuth\Storage'));
     $authResult = $authService->authenticate();
     $result = new ProviderResult();
     $result->setAuthCode($authResult->getCode());
     $result->setMessages($authResult->getMessages());
     $result->setValid($authResult->isValid());
     $result->setName('IdAuth\\Providers\\DbTable');
     $config = $this->serviceManager->get('Config');
     $options = $config['idAuth']['providerOptions']['DbTable'];
     $result->setOptions($options);
     if ($authResult->isValid()) {
         $result->setIdentity($this->queryIdentity($username));
     }
     return $result;
 }
开发者ID:neuweb,项目名称:idauth,代码行数:25,代码来源:DbTableProvider.php

示例5: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $authAdapter = $serviceLocator->get("TSCore\\Auth\\Adapter");
     $auth = new AuthenticationService();
     $auth->setAdapter($authAdapter);
     return $auth;
 }
开发者ID:creativewild,项目名称:TS3UI,代码行数:7,代码来源:ServiceFactory.php

示例6: getServiceConfig

 public function getServiceConfig()
 {
     return array('factories' => array('Zend\\Db\\Adapter\\Adapter' => 'Zend\\Db\\Adapter\\AdapterServiceFactory', 'SanAuth\\Model\\MyAuthStorage' => function ($sm) {
         return new \SanAuth\Model\MyAuthStorage('zf_tutorial');
     }, 'AuthService' => function ($sm) {
         $dbTableAuthAdapter = $sm->get('TableAuthService');
         $authService = new AuthenticationService();
         $authService->setStorage(new \Zend\Authentication\Storage\Session('Auth'));
         // $authService->setStorage($sm->get('SanAuth\Model\MyAuthStorage')); //
         $authService->setAdapter($dbTableAuthAdapter);
         return $authService;
     }, 'AuthService2' => function ($sm) {
         $dbTableAuthAdapter = $sm->get('TableAuth2Service');
         $authService = new AuthenticationService();
         $authService->setStorage(new \Zend\Authentication\Storage\Session('Auth'));
         // $authService->setStorage($sm->get('SanAuth\Model\MyAuthStorage')); //
         $authService->setAdapter($dbTableAuthAdapter);
         return $authService;
     }, 'TableAuthService' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'ta_cliente', 'va_email', 'va_contrasena', 'SHA1(?)');
         //
         return $dbTableAuthAdapter;
     }, 'TableAuth2Service' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'ta_cliente', 'va_email', 'va_contrasena_facebook', 'SHA1(?)');
         //
         return $dbTableAuthAdapter;
     }));
 }
开发者ID:kevcast,项目名称:lsrefactoring,代码行数:30,代码来源:Module.php

示例7: getServiceConfig

 public function getServiceConfig()
 {
     return array('factories' => array('Admin\\Model\\AdminTable' => function ($sm) {
         $tableGateway = $sm->get('AdminTableGateway');
         $table = new AdminTable($tableGateway);
         return $table;
     }, 'AdminTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Admin());
         return new TableGateway('admin', $dbAdapter, null, $resultSetPrototype);
     }, 'Admin\\Model\\PlayerTable' => function ($sm) {
         $tableGateway = $sm->get('PlayerTableGateway');
         $table = new PlayerTable($tableGateway);
         return $table;
     }, 'PlayerTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Player());
         return new TableGateway('player', $dbAdapter, null, $resultSetPrototype);
     }, 'Admin\\Model\\MyAuthStorage' => function ($sm) {
         return new \Admin\Model\MyAuthStorage('adminstore');
     }, 'AuthService' => function ($sm) {
         //My assumption, you've alredy set dbAdapter
         //and has users table with columns : user_name and pass_word
         //that password hashed with md5
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'admin', 'email', 'password', 'MD5(?)');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         $authService->setStorage($sm->get('Admin\\Model\\MyAuthStorage'));
         return $authService;
     }));
 }
开发者ID:bladehr8,项目名称:bowhunter2015,代码行数:34,代码来源:Module.php

示例8: authenticate

 public function authenticate($username, $password)
 {
     $callback = function ($password, $hash) {
         $bcrypt = new Bcrypt();
         return $bcrypt->verify($hash, $password);
     };
     $authenticationService = new AuthenticationService();
     $callbackCheckAdapter = new CallbackCheckAdapter($this->dbAdapter, "users", 'username', 'password', $callback);
     $callbackCheckAdapter->setIdentity($username)->setCredential($password);
     $authenticationService->setAdapter($callbackCheckAdapter);
     $authResult = $authenticationService->authenticate();
     if ($authResult->isValid()) {
         $userObject = $callbackCheckAdapter->getResultRowObject();
         $authenticationService->getStorage()->write($userObject);
         if ($userObject->status == 0) {
             $authenticationService->clearIdentity();
             $this->setCode(-5);
             return false;
         } else {
             return true;
         }
     } else {
         $this->setCode($authResult->getCode());
         return false;
     }
 }
开发者ID:kalelc,项目名称:inventory,代码行数:26,代码来源:AuthSessionAdapter.php

示例9: getServiceConfig

 public function getServiceConfig()
 {
     return array('factories' => array('Application\\Model\\LoginTable' => function ($sm) {
         $tableGateway = $sm->get('LoginTableGateway');
         $table = new LoginTable($tableGateway);
         return $table;
     }, 'LoginTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Login());
         return new TableGateway('users', $dbAdapter, null, $resultSetPrototype);
     }, 'Application\\Model\\JobsTable' => function ($sm) {
         $tableGateway = $sm->get('JobsTableGateway');
         $table = new JobsTable($tableGateway);
         return $table;
     }, 'JobsTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Job());
         return new TableGateway('jobs', $dbAdapter, null, $resultSetPrototype);
     }, 'LoginAuthAdapter' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new AuthAdapter($dbAdapter, 'users', 'username', 'password');
     }, 'AuthStatus' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $authAdapter = new AuthAdapter($dbAdapter, 'users', 'username', 'password');
         $authStatus = new AuthenticationService();
         $authStatus->setAdapter($authAdapter);
         return $authStatus;
     }));
 }
开发者ID:chocorexic,项目名称:demoweb_careers,代码行数:31,代码来源:Module.php

示例10: createService

 public function createService(ServiceLocatorInterface $servicelocator)
 {
     $dbAdapter = $servicelocator->get('Zend\\Db\\Adapter\\Adapter');
     $dbTableAuthAdapter = new DbTable($dbAdapter, 'user', 'username', 'password', 'MD5(?)');
     $authService = new AuthenticationService();
     $authService->setAdapter($dbTableAuthAdapter);
     $authService->setStorage(new MyAuthStorage());
     return $authService;
 }
开发者ID:phanvanthanh,项目名称:NhaSachMoi,代码行数:9,代码来源:MyAuthStorageFactory.php

示例11: getServiceConfig

 public function getServiceConfig()
 {
     return array('factories' => array('AuthService' => function ($serviceManager) {
         $adapter = $serviceManager->get('Zend\\Db\\Adapter\\Adapter');
         $dbAuthAdapter = new DbAuthAdapter($adapter, 'users', 'username', 'password', 'md5(?)');
         $auth = new AuthenticationService();
         $auth->setAdapter($dbAuthAdapter);
         return $auth;
     }));
 }
开发者ID:longhaily,项目名称:MariaTrinhVuong,代码行数:10,代码来源:Module.php

示例12: getServiceConfig

 public function getServiceConfig()
 {
     return array('factories' => array('AuthService' => function ($sm) {
         $dbAdapter = $sm->get('DbAdapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'users', 'email', 'password', 'MD5(?)');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         return $authService;
     }));
 }
开发者ID:AlexanderGrishkevich,项目名称:abc,代码行数:10,代码来源:Module.php

示例13: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $dbAdapter = $serviceLocator->get('ZendDbAdapter');
     $authStorage = $serviceLocator->get('AdminAuthStorage');
     $authAdapter = new DbTable($dbAdapter, 'Users', 'username', 'password', 'MD5(?)');
     $authService = new AuthenticationService();
     $authService->setAdapter($authAdapter);
     $authService->setStorage($authStorage);
     return $authService;
 }
开发者ID:rmukras,项目名称:ekda.org,代码行数:10,代码来源:AdminAuthServiceFactory.php

示例14: getAuthService

 public function getAuthService()
 {
     if (!$this->authservice) {
         $dbAdapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'user', 'email', 'password', 'MD5(?)');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         $this->authservice = $authService;
     }
     return $this->authservice;
 }
开发者ID:narwaria,项目名称:test,代码行数:11,代码来源:DashboardController.php

示例15: getServiceConfig

 public function getServiceConfig()
 {
     return array('factories' => array('Application\\Service\\Model' => function ($sm) {
         return new \Application\Service\Model();
     }, 'Zend\\Authentication\\AuthenticationService' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $authAdapter = new CredentialTreatmentAdapter($dbAdapter, 'admin', 'username', 'password', 'MD5(?)');
         $authService = new AuthenticationService();
         $authService->setAdapter($authAdapter);
         return $authService;
     }));
 }
开发者ID:ntlzz93,项目名称:Zend-Framework-2---IOT,代码行数:12,代码来源:Module.php


注:本文中的Zend\Authentication\AuthenticationService::setAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。