Skip to content
Snippets Groups Projects
Commit bd271be7 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Shibboleth: l'id mis en session ne peut être le supannEmpId/supannEtuId car le...

Shibboleth: l'id mis en session ne peut être le supannEmpId/supannEtuId car le storage Ldap peut trouver un compte correspondant ; prise en compte d'attributs supplémentaires (nom, prénom, civilité)
parent c89fb672
No related branches found
No related tags found
No related merge requests found
......@@ -54,7 +54,7 @@ class AuthController extends AbstractActionController
/** @var AuthenticationService $authService */
$authService = $this->getServiceLocator()->get('zfcuser_auth_service');
try {
$authService->getStorage()->write($shibUser->getId());
$authService->getStorage()->write($shibUser->getUsername());
} catch (ExceptionInterface $e) {
throw new RuntimeException("Impossible d'écrire dans le storage");
}
......
......@@ -156,7 +156,7 @@ class ShibUser implements UserInterface
*/
public function getPrenom()
{
return $this->givenName;
return $this->prenom;
}
/**
......@@ -168,7 +168,7 @@ class ShibUser implements UserInterface
}
/**
* @return string
* @return string|null
*/
public function getCivilite()
{
......@@ -176,9 +176,9 @@ class ShibUser implements UserInterface
}
/**
* @param string $civilite
* @param string|null $civilite
*/
public function setCivilite($civilite)
public function setCivilite($civilite = null)
{
$this->civilite = $civilite;
}
......
......@@ -81,7 +81,7 @@ EOS;
} elseif (isset($_SERVER['supannEmpId'])) {
$id = $_SERVER['supannEmpId'];
} else {
throw new RuntimeException('Un au moins des attributs suivants doivent exister dans $_SERVER : supannEtuId, supannEmpId.');
throw new RuntimeException('Un au moins des attributs suivants doit exister dans $_SERVER : supannEtuId, supannEmpId.');
}
$mail = null;
......@@ -94,11 +94,34 @@ EOS;
$displayName = $_SERVER['displayName'];
}
$surname = null;
if (isset($_SERVER['sn'])) {
$surname = $_SERVER['sn'];
} elseif (isset($_SERVER['surname'])) {
$surname = $_SERVER['surname'];
}
$givenName = null;
if (isset($_SERVER['givenName'])) {
$givenName = $_SERVER['givenName'];
}
$civilite = null;
if (isset($_SERVER['supannCivilite'])) {
$civilite = $_SERVER['supannCivilite'];
}
$shibUser = new ShibUser();
// propriétés de UserInterface
$shibUser->setId($id);
$shibUser->setUsername($eppn);
$shibUser->setDisplayName($displayName);
$shibUser->setEmail($mail);
$shibUser->setPassword(null);
// autres propriétés
$shibUser->setNom($surname);
$shibUser->setPrenom($givenName);
$shibUser->setCivilite($civilite);
return $shibUser;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment