Commit f1eba1aa authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Mise en place du mouchard sur la partie authentification (pour récupérer...

Mise en place du mouchard sur la partie authentification (pour récupérer l'identité et le groupe de la personne qui a eu un dysfonctionement).

For more information, please contact laurent.lecluse@nsa.gov
parent b15b0e90
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -369,6 +369,10 @@ return [
            'UnicaenAuth\Provider\Role\Username'       => 'UnicaenAuth\Provider\Role\UsernameServiceFactory',
            'BjyAuthorize\Service\Authorize'           => 'UnicaenAuth\Service\AuthorizeServiceFactory', // substituion
            'zfcuser_redirect_callback'                => 'UnicaenAuth\Authentication\RedirectCallbackFactory', // substituion
            'MouchardCompleterAuth'        => 'UnicaenAuth\Mouchard\MouchardCompleterAuthFactory',
        ],
        'shared' => [
            'MouchardCompleterAuth'        => false,
        ],
        'initializers'       => [
            'UnicaenAuth\Service\UserAwareInitializer',
+31 −0
Original line number Diff line number Diff line
<?php

namespace UnicaenAuth\Mouchard;

use UnicaenApp\Mouchard\MouchardCompleterInterface;
use UnicaenApp\Mouchard\MouchardMessage;
use UnicaenAuth\Service\Traits\UserContextServiceAwareTrait;
use Zend\Mvc\Application;

/**
 * Interface MouchardCompleterInterface
 *
 * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
 * @package UnicaenApp\Mouchard
 */
class MouchardCompleterAuth implements MouchardCompleterInterface
{
    use UserContextServiceAwareTrait;

    /**
     * @return $this
     */
    public function complete(MouchardMessage $message)
    {
        $message->setUser((string)$this->getServiceUserContext()->getDbUser()->getDisplayName());
        $message->setRole((string)$this->getServiceUserContext()->getSelectedIdentityRole());

        return $this;
    }

}
 No newline at end of file
+30 −0
Original line number Diff line number Diff line
<?php

namespace UnicaenAuth\Mouchard;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

/**
 * Description of MouchardCompleterAuthFactory
 *
 * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
 */
class MouchardCompleterAuthFactory implements FactoryInterface
{
    /**
     * Create service
     *
     * @param ServiceLocatorInterface $serviceLocator
     * @return MouchardCompleterAuth
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $mouchardCompleterAuth = new MouchardCompleterAuth();

        $serviceUserContext = $serviceLocator->get('UnicaenAuth\Service\UserContext');
        $mouchardCompleterAuth->setServiceUserContext($serviceUserContext);

        return $mouchardCompleterAuth;
    }
}
 No newline at end of file