Commit f1eba1aa authored by Laurent Lécluse's avatar Laurent Lécluse
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
......@@ -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',
......
<?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
<?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
Markdown is supported
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