Loading src/UnicaenAuthentification/Entity/Ldap/People.php +3 −1 Original line number Diff line number Diff line Loading @@ -63,8 +63,10 @@ class People extends BasePeople implements UserInterface, ProviderInterface /** * {@inheritDoc} */ public function getUsername() public function getUsername(?string $attribut = "supannAliasLogin") { if ($attribut === 'supannAliasLogin') return $this->supannaliaslogin; if ($attribut === 'uid') return $this->uid; return $this->supannaliaslogin; } Loading src/UnicaenAuthentification/Provider/Identity/Ldap.php +7 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,12 @@ use ZfcUser\Entity\UserInterface; */ class Ldap extends AuthenticationIdentityProvider implements ChainableProvider { protected $usernamefield; public function setUsernamefield(?string $value = null) { $this->usernamefield=$value; } /** * {@inheritDoc} */ Loading Loading @@ -50,7 +56,7 @@ class Ldap extends AuthenticationIdentityProvider implements ChainableProvider } if ($identity instanceof UserInterface) { $roles[] = $identity->getUsername(); $roles[] = $identity->getUsername($this->usernamefield); } return $roles; Loading src/UnicaenAuthentification/Provider/Identity/LdapServiceFactory.php +2 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ class LdapServiceFactory implements FactoryInterface $simpleIdentityProvider->setDefaultRole($config['default_role']); $simpleIdentityProvider->setAuthenticatedRole($config['authenticated_role']); $usernamefield = $config['unicaen-auth']['local']['ldap']['username']; $simpleIdentityProvider->setUsernamefield($usernamefield); return $simpleIdentityProvider; } Loading src/UnicaenAuthentification/Service/UserContext.php +7 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,12 @@ class UserContext extends AbstractService implements EventManagerAwareInterface */ protected $identityRoles; private $usernamefield; public function setUsernamefield(?string $value = null) { $this->usernamefield = $value; } /** * @var AuthenticationService */ Loading Loading @@ -132,7 +138,7 @@ class UserContext extends AbstractService implements EventManagerAwareInterface return $user->getUsername(); } if ($user = $this->getLdapUser()) { return $user->getUsername(); return $user->getUsername($this->usenamefield); } if ($user = $this->getDbUser()) { return $user->getUsername(); Loading src/UnicaenAuthentification/Service/UserContextFactory.php +2 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ class UserContextFactory // mais c'est impossible pour l'instant car il y a un cycle dans les dépendances entre services qui // provoque une boucle infinie. // $usernamefield = $config['unicaen-auth']['local']['ldap']['username']; $service->setUsernamefield($usernamefield); return $service; } } No newline at end of file Loading
src/UnicaenAuthentification/Entity/Ldap/People.php +3 −1 Original line number Diff line number Diff line Loading @@ -63,8 +63,10 @@ class People extends BasePeople implements UserInterface, ProviderInterface /** * {@inheritDoc} */ public function getUsername() public function getUsername(?string $attribut = "supannAliasLogin") { if ($attribut === 'supannAliasLogin') return $this->supannaliaslogin; if ($attribut === 'uid') return $this->uid; return $this->supannaliaslogin; } Loading
src/UnicaenAuthentification/Provider/Identity/Ldap.php +7 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,12 @@ use ZfcUser\Entity\UserInterface; */ class Ldap extends AuthenticationIdentityProvider implements ChainableProvider { protected $usernamefield; public function setUsernamefield(?string $value = null) { $this->usernamefield=$value; } /** * {@inheritDoc} */ Loading Loading @@ -50,7 +56,7 @@ class Ldap extends AuthenticationIdentityProvider implements ChainableProvider } if ($identity instanceof UserInterface) { $roles[] = $identity->getUsername(); $roles[] = $identity->getUsername($this->usernamefield); } return $roles; Loading
src/UnicaenAuthentification/Provider/Identity/LdapServiceFactory.php +2 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ class LdapServiceFactory implements FactoryInterface $simpleIdentityProvider->setDefaultRole($config['default_role']); $simpleIdentityProvider->setAuthenticatedRole($config['authenticated_role']); $usernamefield = $config['unicaen-auth']['local']['ldap']['username']; $simpleIdentityProvider->setUsernamefield($usernamefield); return $simpleIdentityProvider; } Loading
src/UnicaenAuthentification/Service/UserContext.php +7 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,12 @@ class UserContext extends AbstractService implements EventManagerAwareInterface */ protected $identityRoles; private $usernamefield; public function setUsernamefield(?string $value = null) { $this->usernamefield = $value; } /** * @var AuthenticationService */ Loading Loading @@ -132,7 +138,7 @@ class UserContext extends AbstractService implements EventManagerAwareInterface return $user->getUsername(); } if ($user = $this->getLdapUser()) { return $user->getUsername(); return $user->getUsername($this->usenamefield); } if ($user = $this->getDbUser()) { return $user->getUsername(); Loading
src/UnicaenAuthentification/Service/UserContextFactory.php +2 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ class UserContextFactory // mais c'est impossible pour l'instant car il y a un cycle dans les dépendances entre services qui // provoque une boucle infinie. // $usernamefield = $config['unicaen-auth']['local']['ldap']['username']; $service->setUsernamefield($usernamefield); return $service; } } No newline at end of file