Commit 806db90d authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Migration vers laminas

parent d507f84b
Pipeline #11084 passed with stage
in 30 seconds
......@@ -2,10 +2,10 @@
namespace UnicaenAuth;
use Zend\EventManager\EventInterface;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\ServiceProviderInterface;
use Laminas\EventManager\EventInterface;
use Laminas\ModuleManager\Feature\AutoloaderProviderInterface;
use Laminas\ModuleManager\Feature\ConfigProviderInterface;
use Laminas\ModuleManager\Feature\ServiceProviderInterface;
use ZfcUser\Form\Login;
use ZfcUser\Form\LoginFilter;
......@@ -32,7 +32,7 @@ class Module implements AutoloaderProviderInterface, ConfigProviderInterface, Se
public function getAutoloaderConfig()
{
return [
'Zend\Loader\StandardAutoloader' => [
'Laminas\Loader\StandardAutoloader' => [
'namespaces' => [
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
],
......
This diff is collapsed.
......@@ -71,8 +71,8 @@ use UnicaenAuth\View\Helper\UserStatus;
use UnicaenAuth\View\Helper\UserStatusFactory;
use UnicaenAuth\View\Helper\UserUsurpationHelper;
use UnicaenAuth\View\Helper\UserUsurpationHelperFactory;
use Zend\Authentication\AuthenticationService;
use Zend\ServiceManager\Proxy\LazyServiceFactory;
use Laminas\Authentication\AuthenticationService;
use Laminas\ServiceManager\Proxy\LazyServiceFactory;
$settings = [
/**
......@@ -322,7 +322,7 @@ return [
/* role providers simply provide a list of roles that should be inserted
* into the Zend\Acl instance. the module comes with two providers, one
* to specify roles in a config file and one to load roles using a
* Zend\Db adapter.
* Laminas\Db adapter.
*/
'role_providers' => [
/**
......@@ -645,7 +645,7 @@ return [
'aliases' => [
'unicaen-auth_module_options' => ModuleOptions::class,
'zfcuser_login_form' => LoginForm::class,
'Zend\Authentication\AuthenticationService' => 'zfcuser_auth_service',
'Laminas\Authentication\AuthenticationService' => 'zfcuser_auth_service',
'UnicaenAuth\Privilege\PrivilegeProvider' => 'UnicaenAuth\Service\Privilege',
'\UnicaenAuth\Guard\PrivilegeController' => 'UnicaenAuth\Guard\PrivilegeController',
......
......@@ -35,7 +35,7 @@ $config = [
/* role providers simply provide a list of roles that should be inserted
* into the Zend\Acl instance. the module comes with two providers, one
* to specify roles in a config file and one to load roles using a
* Zend\Db adapter.
* Laminas\Db adapter.
*/
'role_providers' => [
/**
......
......@@ -22,7 +22,7 @@ Quatre types d'authentification sont activables dans la configuration du module.
- Pour donner accès à l'application à un nouvel utilisateur, 2 solutions :
- Un informaticien crée à la main l'utilisateur dans la table des utilisateurs ; le mot de passe doit être chiffré
avec “Bcrypt” (exemple en ligne de commande à la racine de votre projet :
`php --run 'require "vendor/autoload.php"; $bcrypt = new Zend\Crypt\Password\Bcrypt(); var_dump($bcrypt->create("azerty"));'`).
`php --run 'require "vendor/autoload.php"; $bcrypt = new Laminas\Crypt\Password\Bcrypt(); var_dump($bcrypt->create("azerty"));'`).
- Si la fonctionnalité est activée (fournie par le module "zf-commons/zfc-user" dont dépend le module unicaen/auth),
l'utilisateur s'enregistre lui-même dans la table des utilisateurs via un formulaire de l'application (le lien figure
sous le formulaire de connexion à l'appli).
......@@ -142,7 +142,7 @@ UserAuthenticatedEventListenerFactory.php
use Application\Entity\Db\Role;
use Doctrine\ORM\EntityManager;
use UnicaenAuth\Service\UserContext as UserContextService;
use Zend\ServiceManager\ServiceLocatorInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
class UserAuthenticatedEventListenerFactory
{
......@@ -170,7 +170,7 @@ Module.php
namespace Application;
use Application\Auth\UserAuthenticatedEventListener;
use Zend\Mvc\MvcEvent;
use Laminas\Mvc\MvcEvent;
class Module
{
......
......@@ -202,7 +202,7 @@ Si vous voulez qu'une entité devienne une ressource, il faut qu'elle implément
namespace Application\Entity\Db;
use Zend\Permissions\Acl\Resource\ResourceInterface;
use Laminas\Permissions\Acl\Resource\ResourceInterface;
class ElementPedagogique implements ResourceInterface
{
......@@ -273,7 +273,7 @@ Son rôle est de répondre true ou false à une demande en fonction d'un certain
AbstractAssertion vous fournit l'accès
- au ServiceLocator,
- au gestionnaire d'événements MVC (Zend\Mvc\MvcEvent) pour éventuellement récupérer des infos sur les paramètres d'URL ou de routeur, etc (utile pour les assertions lancées par les guards),
- au gestionnaire d'événements MVC (Laminas\Mvc\MvcEvent) pour éventuellement récupérer des infos sur les paramètres d'URL ou de routeur, etc (utile pour les assertions lancées par les guards),
- à l'ACL courante (getAcl()),
- au rôle courant (getRole()).
......@@ -332,7 +332,7 @@ Voici maintenant un exemple concret d'assertion :
use Application\Entity\Db\Structure;
use UnicaenAuth\Assertion\AbstractAssertion;
use Application\Acl\Role;
use Zend\Permissions\Acl\Resource\ResourceInterface;
use Laminas\Permissions\Acl\Resource\ResourceInterface;
/**
......
<?php
namespace UnicaenAuth\Acl;
use Zend\Permissions\Acl\Role\RoleInterface;
use Laminas\Permissions\Acl\Role\RoleInterface;
/**
* Rôle avec nom explicite (humainement intelligible).
......
......@@ -7,11 +7,11 @@ use UnicaenAuth\Service\AuthorizeService;
use UnicaenAuth\Service\Traits\AuthorizeServiceAwareTrait;
use UnicaenAuth\Service\Traits\UserContextServiceAwareTrait;
use UnicaenAuth\Service\UserContext;
use Zend\Mvc\MvcEvent;
use Zend\Permissions\Acl\Acl;
use Zend\Permissions\Acl\Assertion\AssertionInterface;
use Zend\Permissions\Acl\Resource\ResourceInterface;
use Zend\Permissions\Acl\Role\RoleInterface;
use Laminas\Mvc\MvcEvent;
use Laminas\Permissions\Acl\Acl;
use Laminas\Permissions\Acl\Assertion\AssertionInterface;
use Laminas\Permissions\Acl\Resource\ResourceInterface;
use Laminas\Permissions\Acl\Role\RoleInterface;
/**
* Description of AbstractAssertion
......
......@@ -4,9 +4,9 @@ namespace UnicaenAuth\Assertion;
use BjyAuthorize\Service\Authorize;
use Interop\Container\ContainerInterface;
use Zend\Authentication\AuthenticationService;
use Zend\Mvc\Application;
use Zend\ServiceManager\Factory\FactoryInterface;
use Laminas\Authentication\AuthenticationService;
use Laminas\Mvc\Application;
use Laminas\ServiceManager\Factory\FactoryInterface;
/**
* Class AssertionFactory
......
......@@ -3,11 +3,11 @@
namespace UnicaenAuth\Authentication\Adapter;
use UnicaenAuth\Authentication\SessionIdentity;
use Zend\Authentication\Storage\StorageInterface;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManagerInterface;
use Zend\EventManager\ListenerAggregateInterface;
use Zend\EventManager\ListenerAggregateTrait;
use Laminas\Authentication\Storage\StorageInterface;
use Laminas\EventManager\EventInterface;
use Laminas\EventManager\EventManagerInterface;
use Laminas\EventManager\ListenerAggregateInterface;
use Laminas\EventManager\ListenerAggregateTrait;
use ZfcUser\Authentication\Adapter\ChainableAdapter;
abstract class AbstractAdapter implements ChainableAdapter, ListenerAggregateInterface
......
......@@ -3,9 +3,9 @@
namespace UnicaenAuth\Authentication\Adapter;
use UnicaenAuth\Options\Traits\ModuleOptionsAwareTrait;
use Zend\Authentication\Result as AuthenticationResult;
use Zend\EventManager\EventInterface;
use Zend\Session\Container as SessionContainer;
use Laminas\Authentication\Result as AuthenticationResult;
use Laminas\EventManager\EventInterface;
use Laminas\Session\Container as SessionContainer;
use ZfcUser\Authentication\Adapter\AdapterChainEvent;
use ZfcUser\Entity\UserInterface;
use ZfcUser\Mapper\UserInterface as UserMapperInterface;
......
......@@ -2,8 +2,8 @@
namespace UnicaenAuth\Authentication\Adapter;
use Zend\Stdlib\RequestInterface as Request;
use Zend\Stdlib\ResponseInterface as Response;
use Laminas\Stdlib\RequestInterface as Request;
use Laminas\Stdlib\ResponseInterface as Response;
use ZfcUser\Exception;
class AdapterChain extends \ZfcUser\Authentication\Adapter\AdapterChain
......
......@@ -7,10 +7,10 @@ use phpCAS;
use UnicaenApp\Mapper\Ldap\People as LdapPeopleMapper;
use UnicaenAuth\Options\Traits\ModuleOptionsAwareTrait;
use UnicaenAuth\Service\User;
use Zend\Authentication\Result as AuthenticationResult;
use Zend\EventManager\EventInterface;
use Zend\Router\RouteInterface;
use Zend\Router\RouteStackInterface;
use Laminas\Authentication\Result as AuthenticationResult;
use Laminas\EventManager\EventInterface;
use Laminas\Router\RouteInterface;
use Laminas\Router\RouteStackInterface;
use ZfcUser\Authentication\Adapter\AdapterChainEvent;
/**
......
......@@ -6,7 +6,7 @@ use Interop\Container\ContainerInterface;
use UnicaenApp\Mapper\Ldap\People as LdapPeopleMapper;
use UnicaenAuth\Options\ModuleOptions;
use UnicaenAuth\Service\User;
use Zend\Authentication\Storage\Session;
use Laminas\Authentication\Storage\Session;
class CasAdapterFactory
{
......
......@@ -2,8 +2,8 @@
namespace UnicaenAuth\Authentication\Adapter;
use Zend\Authentication\Result as AuthenticationResult;
use Zend\Crypt\Password\Bcrypt;
use Laminas\Authentication\Result as AuthenticationResult;
use Laminas\Crypt\Password\Bcrypt;
use ZfcUser\Entity\UserInterface;
/**
......
......@@ -4,7 +4,7 @@ namespace UnicaenAuth\Authentication\Adapter;
use Interop\Container\ContainerInterface;
use UnicaenAuth\Options\ModuleOptions;
use Zend\Authentication\Storage\Session;
use Laminas\Authentication\Storage\Session;
use ZfcUser\Mapper\UserInterface as UserMapperInterface;
class DbAdapterFactory
......
......@@ -7,14 +7,14 @@ use UnicaenApp\Mapper\Ldap\People as LdapPeopleMapper;
use UnicaenApp\Options\ModuleOptions;
use UnicaenAuth\Options\Traits\ModuleOptionsAwareTrait;
use UnicaenAuth\Service\User;
use Zend\Authentication\Adapter\Ldap as LdapAuthAdapter;
use Zend\Authentication\Exception\ExceptionInterface;
use Zend\Authentication\Result as AuthenticationResult;
use Zend\EventManager\Event;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManager;
use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerInterface;
use Laminas\Authentication\Adapter\Ldap as LdapAuthAdapter;
use Laminas\Authentication\Exception\ExceptionInterface;
use Laminas\Authentication\Result as AuthenticationResult;
use Laminas\EventManager\Event;
use Laminas\EventManager\EventInterface;
use Laminas\EventManager\EventManager;
use Laminas\EventManager\EventManagerAwareInterface;
use Laminas\EventManager\EventManagerInterface;
use ZfcUser\Authentication\Adapter\AdapterChainEvent;
/**
......@@ -187,8 +187,8 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface
* @param string $username Identifiant de connexion
* @param string $credential Mot de passe
* @return boolean
* @throws \Zend\Authentication\Adapter\Exception\ExceptionInterface
* @throws \Zend\Ldap\Exception\LdapException
* @throws \Laminas\Authentication\Adapter\Exception\ExceptionInterface
* @throws \Laminas\Ldap\Exception\LdapException
*/
public function authenticateUsername(string $username, string $credential): bool
{
......
......@@ -6,7 +6,7 @@ use Interop\Container\ContainerInterface;
use UnicaenApp\Mapper\Ldap\People as LdapPeopleMapper;
use UnicaenAuth\Options\ModuleOptions;
use UnicaenAuth\Service\User;
use Zend\Authentication\Storage\Session;
use Laminas\Authentication\Storage\Session;
class LdapAdapterFactory
{
......
......@@ -3,9 +3,9 @@
namespace UnicaenAuth\Authentication\Adapter;
use UnicaenAuth\Options\Traits\ModuleOptionsAwareTrait;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManagerAwareTrait;
use Zend\Stdlib\ResponseInterface as Response;
use Laminas\EventManager\EventInterface;
use Laminas\EventManager\EventManagerAwareTrait;
use Laminas\Stdlib\ResponseInterface as Response;
use ZfcUser\Authentication\Adapter\AdapterChainEvent;
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment