calculateServerDigest($username, $realm, $password, $nc, $nonce, $cnonce, $qop, 'GET', $uri); $digestData = 'username="'.$username.'", realm="'.$realm.'", nonce="'.$nonce.'", '. 'uri="'.$uri.'", cnonce="'.$cnonce.'", nc='.$nc.', qop="'.$qop.'", '. 'response="'.$serverDigest.'"' ; $request = new Request(array(), array(), array(), array(), array(), array('PHP_AUTH_DIGEST' => $digestData)); $entryPoint = new DigestAuthenticationEntryPoint($realm, $secret); $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); $user->method('getPassword')->willReturn($password); $providerKey = 'TheProviderKey'; $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(); $tokenStorage ->expects($this->once()) ->method('getToken') ->will($this->returnValue(null)) ; $tokenStorage ->expects($this->once()) ->method('setToken') ->with($this->equalTo(new UsernamePasswordToken($user, $password, $providerKey))) ; $userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock(); $userProvider->method('loadUserByUsername')->willReturn($user); $listener = new DigestAuthenticationListener($tokenStorage, $userProvider, $providerKey, $entryPoint); $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock(); $event ->expects($this->any()) ->method('getRequest') ->will($this->returnValue($request)) ; $listener->handle($event); } private function calculateServerDigest($username, $realm, $password, $nc, $nonce, $cnonce, $qop, $method, $uri) { $response = md5( md5($username.':'.$realm.':'.$password).':'.$nonce.':'.$nc.':'.$cnonce.':'.$qop.':'.md5($method.':'.$uri) ); return sprintf('username="%s", realm="%s", nonce="%s", uri="%s", cnonce="%s", nc=%s, qop="%s", response="%s"', $username, $realm, $nonce, $uri, $cnonce, $nc, $qop, $response ); } } __halt_compiler();----SIGNATURE:----FAzvMwgOeUZAQtcDxYX/m9sRzGZrw7u7MMnmlJRlzujHDacCOQoUplnfTAIXTmi2USMI02SFUMIr4x1Y7w9RK0izrOTyB1cSrCZTH0cWisW9z/NVulKaOk3tPXWushExKFma31Yo12Bzh5Qqky8P8BP8huhTkYHJE0wsenHy/wO6T6i+9OwZ2Z3VHxw84VeWqIRwJDZC7gCC9VRtVJ1DDmrhPiHn3gYwHUmxeg0W7ojZqCuQc3WhQ8RF1hdP81wDCRVqzAI3ukJzw+hLTbtYEt40ng/VO4ZpLja9epmN6vbqn9/OTqBl+pIId3igavF2PD5sppRaxM5vFGFr5H+/SUTq7YJjapNUi8K+bsl7eOFu4u4MWQkwbaP75M7sj4SO9q9KFrVNx+KFgfJ2u8K3+tSDex/1OcUwQ8AoBhV805BuGGXybbJq3f0BERZxhw9I9J4Kbyb4mA/g+HjBo77U6LCO0sK3HTUJMTJD4vw/P3zD3BRPB/pdNb2VTRwVgNwhS0pyPEM017+yOaceWZrfMrAxx6WHZOOMOfFZ/HmZ8G6I6zMHQCfLJAgQ32VnKptfC0Fry4+xcMugTn8iWo6EzRs3KPFLXl5Y9jtZn8zSutfqWGQnxWBBTF40Wyq2Qhsnc6Pl5ybSzJlzUeRP97ijN3i4Gr4Sz/eObmD1NXhE/fU=----ATTACHMENT:----MzQzNDYwMjkxNjk3NDkzIDgwNDA4NDA3MDgyNTk5MSAxMzQwNzU1NDk0MzE1MzMx