Loading src/UnicaenAuth/Authentication/Adapter/Db.php +21 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Interop\Container\ContainerInterface; use UnicaenApp\ServiceManager\ServiceLocatorAwareInterface; use UnicaenApp\ServiceManager\ServiceLocatorAwareTrait; use UnicaenAuth\Options\ModuleOptions; use UnicaenAuth\Options\Traits\ModuleOptionsAwareTrait; use Zend\Authentication\Result as AuthenticationResult; use Zend\Crypt\Password\Bcrypt; use Zend\EventManager\EventInterface; Loading @@ -24,6 +25,8 @@ use ZfcUser\Mapper\UserInterface as UserMapperInterface; */ class Db extends AbstractAdapter implements ServiceLocatorAwareInterface { use ModuleOptionsAwareTrait; const TYPE = 'db'; /** Loading Loading @@ -106,6 +109,10 @@ class Db extends AbstractAdapter implements ServiceLocatorAwareInterface return; } if (! $this->isEnabled()) { return; } $identity = $e->getRequest()->getPost()->get('identity'); $credential = $e->getRequest()->getPost()->get('credential'); $credential = $this->preProcessCredential($credential); Loading Loading @@ -169,6 +176,20 @@ class Db extends AbstractAdapter implements ServiceLocatorAwareInterface ->setMessages(array('Authentication successful.')); } /** * @return bool */ protected function isEnabled() { $config = $this->moduleOptions->getDb(); if (isset($config['enabled'])) { return (bool) $config['enabled']; } return false; } protected function updateUserPasswordHash(UserInterface $userObject, $password, Bcrypt $bcrypt) { $hash = explode('$', $userObject->getPassword()); Loading src/UnicaenAuth/Authentication/Adapter/DbAdapterFactory.php +6 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,12 @@ class DbAdapterFactory $adapter = new Db(); $adapter->setStorage(new Session(Db::class)); $options = array_merge( $container->get('zfcuser_module_options')->toArray(), $container->get('unicaen-auth_module_options')->toArray()); $moduleOptions = new ModuleOptions($options); $adapter->setModuleOptions($moduleOptions); $substitut = $moduleOptions->getDb()['type'] ?? null; if ($substitut !== null) { $adapter->setType($substitut); Loading src/UnicaenAuth/Authentication/Adapter/Ldap.php +18 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,10 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface return; } if (! $this->isEnabled()) { return; } $username = $e->getRequest()->getPost()->get('identity'); $credential = $e->getRequest()->getPost()->get('credential'); Loading Loading @@ -159,6 +163,20 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface $this->userService->userAuthenticated($ldapPeople); } /** * @return bool */ protected function isEnabled() { $config = $this->moduleOptions->getLdap(); if (isset($config['enabled'])) { return (bool) $config['enabled']; } return false; } /** * Extrait le loginUsurpateur et le loginUsurpé si l'identifiant spécifé est de la forme * "loginUsurpateur=loginUsurpé". Loading Loading
src/UnicaenAuth/Authentication/Adapter/Db.php +21 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Interop\Container\ContainerInterface; use UnicaenApp\ServiceManager\ServiceLocatorAwareInterface; use UnicaenApp\ServiceManager\ServiceLocatorAwareTrait; use UnicaenAuth\Options\ModuleOptions; use UnicaenAuth\Options\Traits\ModuleOptionsAwareTrait; use Zend\Authentication\Result as AuthenticationResult; use Zend\Crypt\Password\Bcrypt; use Zend\EventManager\EventInterface; Loading @@ -24,6 +25,8 @@ use ZfcUser\Mapper\UserInterface as UserMapperInterface; */ class Db extends AbstractAdapter implements ServiceLocatorAwareInterface { use ModuleOptionsAwareTrait; const TYPE = 'db'; /** Loading Loading @@ -106,6 +109,10 @@ class Db extends AbstractAdapter implements ServiceLocatorAwareInterface return; } if (! $this->isEnabled()) { return; } $identity = $e->getRequest()->getPost()->get('identity'); $credential = $e->getRequest()->getPost()->get('credential'); $credential = $this->preProcessCredential($credential); Loading Loading @@ -169,6 +176,20 @@ class Db extends AbstractAdapter implements ServiceLocatorAwareInterface ->setMessages(array('Authentication successful.')); } /** * @return bool */ protected function isEnabled() { $config = $this->moduleOptions->getDb(); if (isset($config['enabled'])) { return (bool) $config['enabled']; } return false; } protected function updateUserPasswordHash(UserInterface $userObject, $password, Bcrypt $bcrypt) { $hash = explode('$', $userObject->getPassword()); Loading
src/UnicaenAuth/Authentication/Adapter/DbAdapterFactory.php +6 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,12 @@ class DbAdapterFactory $adapter = new Db(); $adapter->setStorage(new Session(Db::class)); $options = array_merge( $container->get('zfcuser_module_options')->toArray(), $container->get('unicaen-auth_module_options')->toArray()); $moduleOptions = new ModuleOptions($options); $adapter->setModuleOptions($moduleOptions); $substitut = $moduleOptions->getDb()['type'] ?? null; if ($substitut !== null) { $adapter->setType($substitut); Loading
src/UnicaenAuth/Authentication/Adapter/Ldap.php +18 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,10 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface return; } if (! $this->isEnabled()) { return; } $username = $e->getRequest()->getPost()->get('identity'); $credential = $e->getRequest()->getPost()->get('credential'); Loading Loading @@ -159,6 +163,20 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface $this->userService->userAuthenticated($ldapPeople); } /** * @return bool */ protected function isEnabled() { $config = $this->moduleOptions->getLdap(); if (isset($config['enabled'])) { return (bool) $config['enabled']; } return false; } /** * Extrait le loginUsurpateur et le loginUsurpé si l'identifiant spécifé est de la forme * "loginUsurpateur=loginUsurpé". Loading