diff --git a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php index 76517a4d8a..490e409058 100644 --- a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php @@ -82,13 +82,14 @@ class DigestAuthenticationListener implements ListenerInterface return; } + $digestAuth = new DigestData($header); + if (null !== $token = $this->securityContext->getToken()) { if ($token->isImmutable()) { return; } - // FIXME - if ($token instanceof UsernamePasswordToken && $token->isAuthenticated() && (string) $token === $username) { + if ($token instanceof UsernamePasswordToken && $token->isAuthenticated() && (string) $token === $digestAuth->getUsername()) { return; } } @@ -97,8 +98,6 @@ class DigestAuthenticationListener implements ListenerInterface $this->logger->debug(sprintf('Digest Authorization header received from user agent: %s', $header)); } - $digestAuth = new DigestData($header); - try { $digestAuth->validateAndDecode($this->authenticationEntryPoint->getKey(), $this->authenticationEntryPoint->getRealmName()); } catch (BadCredentialsException $e) {