Skip to content

Commit

Permalink
[Security] defer log message in guard authenticator
Browse files Browse the repository at this point in the history
prevent an unneccessary log message if the guard authenticator does not support the current request
  • Loading branch information
eschultz-magix authored and Robin Chalas committed Dec 9, 2018
1 parent 02b3510 commit 21c3030
Showing 1 changed file with 12 additions and 4 deletions.
Expand Up @@ -97,13 +97,17 @@ private function executeGuardAuthenticator($uniqueGuardKey, GuardAuthenticatorIn
{
$request = $event->getRequest();
try {
if (null !== $this->logger) {
$this->logger->debug('Calling getCredentials() on guard authenticator.', array('firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator)));
}

// abort the execution of the authenticator if it doesn't support the request
if ($guardAuthenticator instanceof AuthenticatorInterface) {
if (null !== $this->logger) {
$this->logger->debug('Checking support on guard authenticator.', array('firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator)));
}

if (!$guardAuthenticator->supports($request)) {
if (null !== $this->logger) {
$this->logger->debug('Guard authenticator does not support the request.', array('firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator)));
}

return;
}
// as there was a support for given request,
Expand All @@ -114,6 +118,10 @@ private function executeGuardAuthenticator($uniqueGuardKey, GuardAuthenticatorIn
$credentialsCanBeNull = true;
}

if (null !== $this->logger) {
$this->logger->debug('Calling getCredentials() on guard authenticator.', array('firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator)));
}

// allow the authenticator to fetch authentication info from the request
$credentials = $guardAuthenticator->getCredentials($request);

Expand Down

0 comments on commit 21c3030

Please sign in to comment.