Skip to content

Commit

Permalink
Add extra logging in the login process
Browse files Browse the repository at this point in the history
  • Loading branch information
maartendekeizer committed Apr 25, 2021
1 parent 2d61853 commit c6c35eb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Security/OidcAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,11 @@ public function getUser($credentials, UserProviderInterface $userProvider)
throw new AuthenticationException('Auth server did not supply a e-mail');
}

$this->logger->info('Claims received from IDP', ['claims' => $token->getClaims()]);

$user = $this->gebruikerRepository->findOneBy(['email' => strtolower($token->getClaim('email'))]);
if ($user === null) {
$this->logger->info('No user found, tried with the following claim', ['email' => strtolower($token->getClaim('email'))]);
$user = new Gebruiker();
$user->setEmail($token->getClaim('email'));
$user->setUsername($token->getClaim('email'));
Expand All @@ -188,6 +191,8 @@ public function getUser($credentials, UserProviderInterface $userProvider)
$user->setType(Gebruiker::TYPE_ONBEKEND);
$this->entityManager->persist($user);
$this->entityManager->flush($user);
} else {
$this->logger->info('User found', ['id' => $user->getId()]);
}

return $user;
Expand Down

0 comments on commit c6c35eb

Please sign in to comment.