Example #1
0
 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;
     }));
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $adapter = $serviceLocator->get('auth-adapter');
     $auth = new AuthenticationService();
     $auth->setAdapter($adapter);
     return $auth;
 }
Example #3
0
 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);
     }));
 }
Example #4
0
 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;
 }
Example #5
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $authAdapter = $serviceLocator->get("TSCore\\Auth\\Adapter");
     $auth = new AuthenticationService();
     $auth->setAdapter($authAdapter);
     return $auth;
 }
Example #6
0
 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;
     }));
 }
Example #7
0
 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;
     }));
 }
Example #8
0
 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;
     }
 }
Example #9
0
 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;
     }));
 }
 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;
 }
Example #11
0
 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;
     }));
 }
Example #12
0
 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;
     }));
 }
 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;
 }
Example #14
0
 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;
 }
Example #15
0
 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;
     }));
 }
Example #16
0
 public function getServiceConfig()
 {
     return array('factories' => array('User\\Model\\MyAuthStorage' => function ($sm) {
         return new \User\Model\MyAuthStorage('zf_tutorial');
     }, 'AuthService' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 't_usuarios_servidorlocal', 'USER_NAME', 'PASSWORD');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         $authService->setStorage($sm->get('User\\Model\\MyAuthStorage'));
         return $authService;
     }, 'UserFunctions' => function ($sm) {
         $UserFunctions = new UserFunctions($sm);
         return $UserFunctions;
     }, 'UserTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new User());
         return new TableGateway('t_usuarios_servidorlocal', $dbAdapter, null, $resultSetPrototype);
     }, 'AdminTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Admin());
         return new TableGateway('t_adminlocales', $dbAdapter, null, $resultSetPrototype);
     }, 'SponsorTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new SponsorLocal());
         return new TableGateway('t_sponsorslocales', $dbAdapter, null, $resultSetPrototype);
     }, 'DuenoTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new DuenoLocal());
         return new TableGateway('t_duenoslocales', $dbAdapter, null, $resultSetPrototype);
     }, 'CampaignTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Campaign());
         return new TableGateway('t_campanassponsorlocal', $dbAdapter, null, $resultSetPrototype);
     }, 'PromoTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Promo());
         return new TableGateway('t_publicidadeslocales', $dbAdapter, null, $resultSetPrototype);
     }, 'controlsSPONSOR_LOCAL' => function ($sm) {
         return new \User\Model\SponsorControls();
     }, 'controlsDUENO_LOCAL' => function ($sm) {
         return new \User\Model\DuenoControls();
     }, 'controlsADMIN' => function ($sm) {
         return new \User\Model\AdminControls();
     }));
 }
Example #17
0
 public function getServiceConfig()
 {
     return array('factories' => array('SanAuth\\Model\\MyAuthStorage' => function ($sm) {
         return new \SanAuth\Model\MyAuthStorage('zf_tutorial');
     }, 'AuthService' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'users', 'login', 'password', 'MD5(?)');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         $authService->setStorage($sm->get('SanAuth\\Model\\MyAuthStorage'));
         return $authService;
     }));
 }
 public function getAuthService()
 {
     //print_r($this->request->getPost());
     if (!$this->authservice) {
         //$this->flashMessenger()->setNamespace('NotLogin')->addMessage('error');
         $dbAdapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'user', 'user_email', 'user_password', 'MD5(?)');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         $this->authservice = $authService;
     }
     return $this->authservice;
 }
Example #19
0
 public function getServiceConfig()
 {
     return array('factories' => array('Auth\\Model\\MyAuthStorage' => function ($sm) {
         return new MyStorage("admin");
     }, 'AuthService' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'uzytkownicy_ewidencja', 'login', 'haslo', 'status = 1');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         $authService->setStorage($sm->get('Auth\\Model\\MyAuthStorage'));
         return $authService;
     }));
 }
Example #20
0
 public function getServiceConfig()
 {
     return array('factories' => array('Application\\Model\\MyAuthStorage' => function ($sm) {
         return new \Application\Model\MyAuthStorage('zf_rally');
     }, 'AuthService' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'Users', 'email', 'password', 'SHA1(?)');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         $authService->setStorage($sm->get('Application\\Model\\MyAuthStorage'));
         return $authService;
     }));
 }
Example #21
0
 public function getServiceConfig()
 {
     return array('factories' => array('AuthStorage' => function ($sm) {
         return new \Application\Helpers\AuthStorage();
     }, 'AuthService' => function ($sm) {
         $entityManager = $sm->get('doctrine.entitymanager.orm_default');
         $doctrineAuthAdapter = new ObjectRepository(array('objectManager' => $entityManager, 'identityClass' => 'Application\\Entity\\User', 'identityProperty' => 'email', 'credentialProperty' => 'password', 'credentialCallable' => function ($identity, $credential) use($sm) {
             return md5($credential) == $identity->getPassword();
         }));
         $authService = new AuthenticationService();
         $authService->setAdapter($doctrineAuthAdapter);
         $authService->setStorage($sm->get('AuthStorage'));
         return $authService;
     }));
 }
Example #22
0
 public function getAuthService()
 {
     if (!$this->authservice) {
         $dbAdapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
         //$dbAdapter = $this->getServiceLocator()->get('UserTableGateway');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'user', 'email', 'password', 'MD5(?)');
         $authService = new AuthenticationService();
         //utilisation du sm
         //$authService = $this->getServiceLocator()->get('authService');
         //$arrUserDetails     =   $authservice->getIdentity();
         $authService->setAdapter($dbTableAuthAdapter);
         $this->authservice = $authService;
     }
     return $this->authservice;
 }
Example #23
0
 protected function initServices(ServiceManager $sm)
 {
     // Initialize log service
     $logger = new Logger();
     $writer = new StreamLogWriter(__DIR__ . '/../../data/log/template.log');
     $logger->addWriter($writer);
     Logger::registerErrorHandler($logger);
     $sm->setService('log', $logger);
     // Initialize authentication service
     $mongodb = $sm->get('mongodb');
     $authAdapter = new AuthAdapter($mongodb->users);
     $auth = new AuthenticationService();
     $auth->setAdapter($authAdapter);
     $sm->setService('auth', $auth);
 }
Example #24
0
 public function getServiceConfig()
 {
     return array('factories' => array('Admin\\Model\\UserTable' => function ($sm) {
         $adapter = $sm->get('AdminDbAdapter');
         $userObj = new \Admin\Model\UserTable($adapter);
         return $userObj;
     }, 'AdminDbAdapter' => function ($sm) {
         return $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
     }, 'AuthService' => function ($sm) {
         $adapter = $sm->get('AdminDbAdapter');
         $dbAuthAdapter = new DbAuthAdapter($adapter, 'sh_system_user', 'email_id', 'password');
         $auth = new AuthenticationService();
         $auth->setAdapter($dbAuthAdapter);
         return $auth;
     }));
 }
Example #25
0
 public function getServiceConfig()
 {
     return array('factories' => array('Employee\\Model\\MyEmpolyeeStorage' => function ($sm) {
         return new \Employee\Model\MyEmployeeStorage();
     }, '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, 'employee', 'username', 'password', 'MD5(?)');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         $authService->setStorage($sm->get('Employee\\Model\\MyEmpolyeeStorage'));
         return $authService;
     }));
 }
Example #26
0
 public function getServiceConfig()
 {
     return array('factories' => array('log' => function ($sm) {
         $log = new Logger();
         $writer = new FirePhpWriter(new FirePhpBridge(new \FirePHP()));
         $log->addWriter($writer);
         return $log;
     }, 'Application\\Storage\\Login' => function ($sm) {
         return new \Application\Storage\Login('nhpress');
     }, 'Zend\\Session\\SessionManager' => function ($sm) {
         $config = $sm->get('config');
         if (isset($config['session'])) {
             $session = $config['session'];
             $sessionConfig = null;
             if (isset($session['config'])) {
                 $class = isset($session['config']['class']) ? $session['config']['class'] : 'Zend\\Session\\Config\\SessionConfig';
                 $options = isset($session['config']['options']) ? $session['config']['options'] : array();
                 $sessionConfig = new $class();
                 $sessionConfig->setOptions($options);
             }
             $sessionStorage = null;
             if (isset($session['storage'])) {
                 $class = $session['storage'];
                 $sessionStorage = new $class();
             }
             $sessionSaveHandler = null;
             if (isset($session['save_handler'])) {
                 $sessionSaveHandler = $sm->get($session['save_handler']);
             }
             $sessionManager = new SessionManager($sessionConfig, $sessionStorage, $sessionSaveHandler);
         } else {
             $sessionManager = new SessionManager();
         }
         Container::setDefaultManager($sessionManager);
         return $sessionManager;
     }, 'AuthService' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter);
         $dbTableAuthAdapter->setTableName('correspondent');
         $dbTableAuthAdapter->setIdentityColumn('username');
         $dbTableAuthAdapter->setCredentialColumn('password');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         $authService->setStorage($sm->get('Application\\Storage\\Login'));
         return $authService;
     }));
 }
Example #27
0
 public function getServiceConfig()
 {
     return array('factories' => array('AuthService' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'user', 'email', 'password', 'MD5(?)');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         return $authService;
     }, 'UserTable' => function ($sm) {
         $tableGateway = $sm->get('UserTableGateway');
         $table = new UserTable($tableGateway);
         return $table;
     }, 'UserTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new User());
         return new TableGateway('user', $dbAdapter, null, $resultSetPrototype);
     }, 'AnimeTable' => function ($sm) {
         $tableGateway = $sm->get('AnimeTableGateway');
         $table = new AnimeTable($tableGateway);
         return $table;
     }, 'AnimeTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Anime());
         return new TableGateway('anime', $dbAdapter, null, $resultSetPrototype);
     }, 'UsersEditForm' => function ($sm) {
         $form = new Form\UsersEditForm();
         $form->setInputFilter($sm->get('UsersEditFilter'));
         return $form;
     }, 'UsersEditFilter' => function ($sm) {
         return new Form\UsersEditFilter();
     }, 'AnimeEditForm' => function ($sm) {
         $form = new Form\AnimeEditForm();
         $form->setInputFilter($sm->get('AnimeEditFilter'));
         return $form;
     }, 'AnimeEditFilter' => function ($sm) {
         return new Form\AnimeEditFilter();
     }, 'AnimeCreateForm' => function ($sm) {
         $form = new Form\AnimeCreateForm();
         $form->setInputFilter($sm->get('AnimeCreateFilter'));
         return $form;
     }, 'AnimeCreateFilter' => function ($sm) {
         return new Form\AnimeCreateFilter();
     }));
 }
 public function getServiceConfig()
 {
     return array('factories' => array('tisuser\\Model\\AuthStorage' => function ($sm) {
         return new \tisuser\Model\AuthStorage('');
     }, 'AuthService' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'users', 'username', 'password', 'MD5(?)');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         //$authService->setStorage($sm->get('tisuser\Model\AuthStorage'));
         return $authService;
     }, 'user_table' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $table = new UserTable($dbAdapter);
         return $table;
     }));
 }
Example #29
0
 public function getServiceConfig()
 {
     return array('factories' => array('Auth\\Model\\UserTable' => function ($sm) {
         $tableGateway = $sm->get('UserTableGateway');
         $table = new UserTable($tableGateway);
         return $table;
     }, 'UserTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new User());
         return new TableGateway('users', $dbAdapter, null, $resultSetPrototype);
     }, 'AuthService' => function ($serviceManager) {
         $adapter = $serviceManager->get('Zend\\Db\\Adapter\\Adapter');
         $dbAuthAdapter = new DbAuthAdapter($adapter, 'users', 'email', 'password');
         $auth = new AuthenticationService();
         $auth->setAdapter($dbAuthAdapter);
         return $auth;
     }));
 }
Example #30
0
 public function getServiceConfig()
 {
     return array('abstract_factories' => array(), 'aliases' => array(), 'factories' => array('ProductTable' => function ($sm) {
         return new ProductTable($sm->get('ProductTableGateway'));
     }, 'ProductTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Product());
         return new TableGateway('products', $dbAdapter, null, $resultSetPrototype);
     }, 'Product' => function ($sm) {
         return new Product();
     }, 'UserTable' => function ($sm) {
         return new UserTable($sm->get('UserTableGateway'));
     }, 'UserTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new User());
         return new TableGateway('users', $dbAdapter, null, $resultSetPrototype);
     }, 'User' => function ($sm) {
         return new User();
     }, 'OrderTable' => function ($sm) {
         return new OrderTable($sm->get('OrderTableGateway'));
     }, 'OrderTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Order());
         return new TableGateway('orders', $dbAdapter, null, $resultSetPrototype);
     }, 'Order' => function ($sm) {
         return new Order();
     }, 'Form' => function ($sm) {
         $form = new FormFields();
         $form->setInputFilter($sm->get('FormFilter'));
         return $form;
     }, 'FormFilter' => function ($sm) {
         return new FormFilter();
     }, 'AuthService' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'users', 'email', 'password', 'MD5(?)');
         $authservice = new AuthenticationService();
         return $authservice->setAdapter($dbTableAuthAdapter);
     }), 'invokables' => array(), 'services' => array(), 'shared' => array());
 }