Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
auth
Commits
b15b0e90
Commit
b15b0e90
authored
Jun 13, 2017
by
Stephane Bouvry
Browse files
Levée d'un événement lors des erreurs d'authentification.
parent
56b58530
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/UnicaenAuth/Authentication/Adapter/Ldap.php
View file @
b15b0e90
...
...
@@ -5,9 +5,12 @@ use UnicaenAuth\Options\ModuleOptions;
use
Zend\Authentication\Exception\UnexpectedValueException
;
use
Zend\Authentication\Result
as
AuthenticationResult
;
use
Zend\Authentication\Adapter\Ldap
as
LdapAuthAdapter
;
use
Zend\Authentication\Result
;
use
Zend\EventManager\Event
;
use
Zend\EventManager\EventManager
;
use
Zend\EventManager\EventManagerAwareInterface
;
use
Zend\EventManager\EventManagerInterface
;
use
Zend\Ldap\Exception\LdapException
;
use
Zend\ServiceManager\ServiceManager
;
use
Zend\ServiceManager\ServiceManagerAwareInterface
;
use
ZfcUser\Authentication\Adapter\AbstractAdapter
;
...
...
@@ -110,7 +113,22 @@ class Ldap extends AbstractAdapter implements ServiceManagerAwareInterface, Even
}
// LDAP auth
/** @var Result $result */
$result
=
$this
->
getLdapAuthAdapter
()
->
setUsername
(
$username
)
->
setPassword
(
$credential
)
->
authenticate
();
if
(
$result
&&
count
(
$result
->
getMessages
()))
{
// Obtenir le message LDAP
// $msg = preg_replace('/\[0x\d* \((.*)\):/','$1', $event->getParam('result')->getMessages()[1]);
$eventClasse
=
new
Event
(
'authentication.ldap.error'
);
$eventClasse
->
setTarget
(
$this
)
->
setParams
([
'result'
=>
$result
]);
$this
->
getEventManager
()
->
trigger
(
$eventClasse
);
}
$success
=
$result
->
isValid
();
// verif existence du login usurpé
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment