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:----W7p8JxAQy9dtaIhceyRzBk77ix8KH+5ui2BPQ3uCcgY33ZuJafqBPPCOJKZdSMEgXJ55lQOjyK/b7zaCt2UUK8ot1FuwMjKqOUxSPqbuhDC/fYL74+JG7BaOzjepYyabkkzagc2FlPP58wyToelotFfclRu26rsgNCFYWL9QT6ha5nMvwUz/si8sn5l+nR9/AfzGxpFNFpnR0ql7K1dQj5xk2o3hWAIxsU/nSsSnwu//dkjQNodlMO7U/hompO7dfOGzYgKIW1H3hgyKGcLWrstPBhG0n8DIw5wmEIXPSGRknQYpPDEm26yqpwT4k3C2sq0aSW9/qvMu9AZ1YnEnUMaJ/H+glC1Hy+hlP3WBAW5D1QvLYHV6rpDtcHELFAYowOCtAXR/tffteJKglKwn7ZgQMIocU8RySy7B5sT9yaZwhERxgoAbkGs56tExmdRdlPD3o8sz/H7TG9MgU5IXDW+Iftlf7NkhedeFutSnqcIheE/Mov187MDQCS5AdjLtoHqkFx2XDOTVo9yQp8IvD7dMDf3Ix0ck6Me3oAWVjblkOTha0B745vHqhPE4VGZZHTcHDiFtdvXukf262AKobvuSuC3dl8t7JWbvKQ34xDhz5Z34o4mf4MzTgZBR925Z3NXJ2W6YFFexrLkubaGjttct1BnomU99qXKQGkRetIQ=----ATTACHMENT:----NjkwOTU5NDMyNjYxNDYyNyAxODAzMTA0NjA0MjMxNDIzIDM3OTczMzEyMjM1ODMxMjg=