Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • 5.x
  • ll-php8-bs5
  • release_5_bs5
  • ll-php8
  • 4.x
  • laminas_migration
  • release_1.0.0.2
  • release_4.0.0
  • release_3.2.8
  • bootstrap4_migration
  • 1.0.0.3
  • 6.0.7
  • 6.0.6
  • 6.0.5
  • 6.0.4
  • 6.0.3
  • 6.0.2
  • 6.0.1
  • 5.1.1
  • 6.0.0
  • 5.1.0
  • 5.0.0
  • 4.0.2
  • 3.2.11
  • 4.0.1
  • 3.2.10
  • 4.0.0
  • 1.0.0.2
  • 3.2.9
  • 3.2.8
31 results

module.config.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    module.config.php 14.09 KiB
    <?php
    $settings = array(
        /**
         * Fournisseurs d'identité.
         */
        'identity_providers' => array(
            300 => 'UnicaenAuth\Provider\Identity\Basic', // en 1er
            200 => 'UnicaenAuth\Provider\Identity\Db',    // en 2e
            100 => 'UnicaenAuth\Provider\Identity\Ldap',  // en 3e
        ),
    );
    
    $zfcuserSettings = array(
        /**
         * Enable registration
         * Allows users to register through the website.
         * Accepted values: boolean true or false
         */
        'enable_registration' => true,
        /**
         * Modes for authentication identity match
         * Specify the allowable identity modes, in the order they should be
         * checked by the Authentication plugin.
         * Default value: array containing 'email'
         * Accepted values: array containing one or more of: email, username
         */
        'auth_identity_fields' => array('username', 'email'),
        /**
         * Login Redirect Route
         * Upon successful login the user will be redirected to the entered route
         * Default value: 'zfcuser'
         * Accepted values: A valid route name within your application
         */
        'login_redirect_route' => 'home',
        /**
         * Logout Redirect Route
         * Upon logging out the user will be redirected to the enterd route
         * Default value: 'zfcuser/login'
         * Accepted values: A valid route name within your application
         */
        'logout_redirect_route' => 'home',
        /**
         * Enable Username
         * Enables username field on the registration form, and allows users to log
         * in using their username OR email address. Default is false.
         * Accepted values: boolean true or false
         */
        'enable_username' => false,
        /**     
         * Enable Display Name
         * Enables a display name field on the registration form, which is persisted
         * in the database. Default value is false.
         * Accepted values: boolean true or false
         */
        'enable_display_name' => true,
        /**     
         * Authentication Adapters
         * Specify the adapters that will be used to try and authenticate the user
         * Default value: array containing 'ZfcUser\Authentication\Adapter\Db' with priority 100
         * Accepted values: array containing services that implement 'ZfcUser\Authentication\Adapter\ChainableAdapter'
         */
        'auth_adapters' => array(
            300 => 'UnicaenAuth\Authentication\Adapter\Ldap', // notifié en 1er
            200 => 'UnicaenAuth\Authentication\Adapter\Db',   //         ensuite (si échec d'authentification Ldap)
            100 => 'UnicaenAuth\Authentication\Adapter\Cas',  //         ensuite (si échec d'authentification Db)
        ),
        
        // telling ZfcUser to use our own class
        'user_entity_class'       => 'UnicaenAuth\Entity\Db\User',
        // telling ZfcUserDoctrineORM to skip the entities it defines
        'enable_default_entities' => false,
    );
        
    $bjyauthorize = array(
        /* this module uses a meta-role that inherits from any roles that should
         * be applied to the active user. the identity provider tells us which
         * roles the "identity role" should inherit from.
         *
         * for ZfcUser, this will be your default identity provider
         */
        'identity_provider' => 'UnicaenAuth\Provider\Identity\Chain',
        
        /* 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.
         */
        'role_providers' => array(
            /**
             * 2 rôles doivent systématiquement exister dans les ACL :
             * - le rôle par défaut 'guest', c'est le rôle de tout utilisateur non authentifié.
             * - le rôle 'user', c'est le rôle de tout utilisateur authentifié.
             */
            'UnicaenAuth\Provider\Role\Config' => array(
                'guest' => array('name' => "Non authentifié(e)", 'selectable' => false, 'children' => array(
                    'user' => array('name' => "Authentifié(e)", 'selectable' => false)
                )),
            ),
            /**
             * Fournit les rôles issus de la base de données éventuelle de l'appli.
             * NB: si le rôle par défaut 'guest' est fourni ici, il ne sera pas ajouté en double dans les ACL.
             * NB: si la connexion à la base échoue, ce n'est pas bloquant!
             */
            'UnicaenAuth\Provider\Role\DbRole' => array(
                'object_manager'    => 'doctrine.entitymanager.orm_default',
                'role_entity_class' => 'UnicaenAuth\Entity\Db\Role',
            ),
            /**
             * Fournit le rôle correspondant à l'identifiant de connexion de l'utilisateur.
             * Cela est utile lorsque l'on veut gérer les habilitations d'un utilisateur unique
             * sur des ressources.
             */
            'UnicaenAuth\Provider\Role\Username' => array(),
        ),
    
        // strategy service name for the strategy listener to be used when permission-related errors are detected
    //    'unauthorized_strategy' => 'BjyAuthorize\View\RedirectionStrategy',
        'unauthorized_strategy' => 'UnicaenAuth\View\RedirectionStrategy',
        
        /* Currently, only controller and route guards exist
         */
        'guards' => array(
            /* If this guard is specified here (i.e. it is enabled), it will block
             * access to all controllers and actions unless they are specified here.
             * You may omit the 'action' index to allow access to the entire controller
             */
            'BjyAuthorize\Guard\Controller' => array(
                array('controller' => 'index', 'action' => 'index',   'roles' => array()),
                array('controller' => 'zfcuser',                      'roles' => array()),
                array('controller' => 'Application\Controller\Index', 'roles' => array()),
    
                array('controller' => 'UnicaenApp\Controller\Application',  'action' => 'etab',                     'roles' => array()),
                array('controller' => 'UnicaenApp\Controller\Application',  'action' => 'apropos',                  'roles' => array()),
                array('controller' => 'UnicaenApp\Controller\Application',  'action' => 'contact',                  'roles' => array()),
                array('controller' => 'UnicaenApp\Controller\Application',  'action' => 'plan',                     'roles' => array()),
                array('controller' => 'UnicaenApp\Controller\Application',  'action' => 'mentions-legales',         'roles' => array()),
                array('controller' => 'UnicaenApp\Controller\Application',  'action' => 'informatique-et-libertes', 'roles' => array()),
                array('controller' => 'UnicaenApp\Controller\Application',  'action' => 'refresh-session',          'roles' => array()),
                array('controller' => 'UnicaenAuth\Controller\Utilisateur', 'action' => 'selectionner-profil',      'roles' => array()),
            ),
        ),
    );
    
    return array(
        'zfcuser' => $zfcuserSettings,
        'bjyauthorize' => $bjyauthorize,
        'unicaen-auth' => $settings,
        'doctrine' => array(
            'driver' => array(
                // overriding zfc-user-doctrine-orm's config
                'zfcuser_entity' => array(
                    'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                    'paths' => array(
                        __DIR__ . '/../src/UnicaenAuth/Entity/Db'
                    )
                ),
                'orm_auth_driver' => array(
                    'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                    'cache' => 'array',
                    'paths' => array(
                        __DIR__ . '/../src/UnicaenAuth/Entity/Db'
                    )
                ),
                'orm_default' => array(
                    'class'   => 'Doctrine\ORM\Mapping\Driver\DriverChain',
                    'drivers' => array(
                        'UnicaenAuth\Entity\Db' => 'zfcuser_entity',
                        'UnicaenAuth\Entity\Db' => 'orm_auth_driver'
                    )
                ),
            ),
        ),
        'service_manager' => array(
            'aliases' => array(
                'Zend\Authentication\AuthenticationService' => 'zfcuser_auth_service',
            ),
            'invokables' => array(
                'unicaen-auth_user_service'               => 'UnicaenAuth\Service\User',
                'UnicaenAuth\Authentication\Storage\Db'   => 'UnicaenAuth\Authentication\Storage\Db',
                'UnicaenAuth\Authentication\Storage\Ldap' => 'UnicaenAuth\Authentication\Storage\Ldap',
                'UnicaenAuth\View\RedirectionStrategy'    => 'UnicaenAuth\View\RedirectionStrategy',
                'authUserContext'                         => 'UnicaenAuth\Service\UserContext'
            ),
            'abstract_factories' => array(
                'UnicaenAuth\Authentication\Adapter\AbstractFactory',
            ),
            'factories' => array(
                'unicaen-auth_module_options'              => 'UnicaenAuth\Options\ModuleOptionsFactory',
                'zfcuser_auth_service'                     => 'UnicaenAuth\Authentication\AuthenticationServiceFactory',
                'UnicaenAuth\Authentication\Storage\Chain' => 'UnicaenAuth\Authentication\Storage\ChainServiceFactory',
                'UnicaenAuth\Provider\Identity\Chain'      => 'UnicaenAuth\Provider\Identity\ChainServiceFactory',
                'UnicaenAuth\Provider\Identity\Ldap'       => 'UnicaenAuth\Provider\Identity\LdapServiceFactory',
                'UnicaenAuth\Provider\Identity\Db'         => 'UnicaenAuth\Provider\Identity\DbServiceFactory',
                'UnicaenAuth\Provider\Identity\Basic'         => 'UnicaenAuth\Provider\Identity\BasicServiceFactory',
                'UnicaenAuth\Provider\Role\Config'         => 'UnicaenAuth\Provider\Role\ConfigServiceFactory',
                'UnicaenAuth\Provider\Role\DbRole'         => 'UnicaenAuth\Provider\Role\DbRoleServiceFactory',
                'UnicaenAuth\Provider\Role\Username'       => 'UnicaenAuth\Provider\Role\UsernameServiceFactory',
            ),
            'initializers' => array(
                'UnicaenAuth\Service\UserAwareInitializer',
            ),
        ),
        'controllers' => array(
            'invokables' => array(
                'UnicaenAuth\Controller\Utilisateur' => 'UnicaenAuth\Controller\UtilisateurController',
            ),
        ),
        'view_manager' => array(
            'template_map' => array(
                'error/403' => __DIR__ . '/../view/error/403.phtml',
            ),
            'template_path_stack' => array(
                'unicaen-auth' => __DIR__ . '/../view',
            ),
        ),
        'translator' => array(
            'translation_file_patterns' => array(
                array(
                    'type'     => 'gettext',
                    'base_dir' => __DIR__ . '/../language',
                    'pattern'  => '%s.mo',
                ),
            ),
        ),
        'router' => array(
            'routes' => array(
                'zfcuser' => array(
                    'type' => 'Literal',
                    'priority' => 1000,
                    'options' => array(
                        'route' => '/auth',
                        'defaults' => array(
                            'controller' => 'zfcuser',
                            'action'     => 'index',
                        ),
                    ),
                    'may_terminate' => true,
                    'child_routes' => array(
                        'login' => array(
                            'type' => 'Literal',
                            'options' => array(
                                'route' => '/connexion',
                                'defaults' => array(
                                    'controller' => 'zfcuser',
                                    'action'     => 'login',
                                ),
                            ),
                        ),
                        'logout' => array(
                            'type' => 'Literal',
                            'options' => array(
                                'route' => '/deconnexion',
                                'defaults' => array(
                                    'controller' => 'zfcuser',
                                    'action'     => 'logout',
                                ),
                            ),
                        ),
                        'register' => array(
                            'type' => 'Literal',
                            'options' => array(
                                'route' => '/creation-compte',
                                'defaults' => array(
                                    'controller' => 'zfcuser',
                                    'action'     => 'register',
                                ),
                            ),
                        ),
                    ),
                ),
                'utilisateur' => array(
                    'type'    => 'Literal',
                    'options' => array(
                        'route'    => '/utilisateur',
                        'defaults' => array(
                            '__NAMESPACE__' => 'UnicaenAuth\Controller',
                            'controller'    => 'Utilisateur',
                            'action'        => 'index',
                        ),
                    ),
                    'may_terminate' => true,
                    'child_routes' => array(
                        'default' => array(
                            'type'    => 'Segment',
                            'options' => array(
                                'route'    => '/:action[/:id]',
                                'constraints' => array(
                                    'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                    'id'     => '[0-9]*',
                                ),
                                'defaults' => array(
                                    'action' => 'index',
                                ),
                            ),
                        ),
                    ),
                ),
            ),
        ),
        // All navigation-related configuration is collected in the 'navigation' key
        'navigation' => array(
            // The DefaultNavigationFactory we configured uses 'default' as the sitemap key
            'default' => array(
                // And finally, here is where we define our page hierarchy
                'home' => array(
                    'pages' => array(
                        'login' => array(
                            'label'    => _("Connexion"),
                            'route'    => 'zfcuser/login',
                            'visible'  => false,
                        ),
                        'register' => array(
                            'label'   => _("Enregistrement"),
                            'route'   => 'zfcuser/register',
                            'visible' => false,
                        ),
                    ),
                ),
            ),
        ),
    );