| @@ 150-158 (lines=9) @@ | ||
| 147 | /** @var AuthenticationResponse $response */ |
|
| 148 | $response = $this->ldap->getConnection()->execute($auth); |
|
| 149 | ||
| 150 | if (!$response->isAuthenticated()) { |
|
| 151 | $this->userChecker->checkLdapErrorCode( |
|
| 152 | $user, |
|
| 153 | $response->getErrorCode(), |
|
| 154 | $this->ldap->getConnection()->getConfig()->getLdapType() |
|
| 155 | ); |
|
| 156 | ||
| 157 | throw new BadCredentialsException($response->getErrorMessage(), $response->getErrorCode()); |
|
| 158 | } |
|
| 159 | $this->dispatcher->dispatch(LdapLoginEvent::SUCCESS, new LdapLoginEvent($user, $token)); |
|
| 160 | ||
| 161 | $newToken = new UsernamePasswordToken($user, null, $this->providerKey, $user->getRoles()); |
|
| @@ 192-201 (lines=10) @@ | ||
| 189 | $credentials['password'] |
|
| 190 | ) |
|
| 191 | ); |
|
| 192 | if (!$response->isAuthenticated()) { |
|
| 193 | $this->userChecker->checkLdapErrorCode( |
|
| 194 | $user, |
|
| 195 | $response->getErrorCode(), |
|
| 196 | $this->ldap->getConnection()->getConfig()->getLdapType() |
|
| 197 | ); |
|
| 198 | throw new CustomUserMessageAuthenticationException( |
|
| 199 | $response->getErrorMessage(), [], $response->getErrorCode() |
|
| 200 | ); |
|
| 201 | } |
|
| 202 | // No way to get the token from the Guard, need to create one to pass... |
|
| 203 | $token = new UsernamePasswordToken($user, $credentials['password'], 'ldap-tools', $user->getRoles()); |
|
| 204 | $token->setAttribute('ldap_domain', $credDomain); |
|