* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Http\Tests\EntryPoint; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Http\EntryPoint\DigestAuthenticationEntryPoint; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\NonceExpiredException; /** * @group legacy */ class DigestAuthenticationEntryPointTest extends TestCase { public function testStart() { $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); $authenticationException = new AuthenticationException('TheAuthenticationExceptionMessage'); $entryPoint = new DigestAuthenticationEntryPoint('TheRealmName', 'TheSecret'); $response = $entryPoint->start($request, $authenticationException); $this->assertEquals(401, $response->getStatusCode()); $this->assertRegExp('/^Digest realm="TheRealmName", qop="auth", nonce="[a-zA-Z0-9\/+]+={0,2}"$/', $response->headers->get('WWW-Authenticate')); } public function testStartWithNoException() { $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); $entryPoint = new DigestAuthenticationEntryPoint('TheRealmName', 'TheSecret'); $response = $entryPoint->start($request); $this->assertEquals(401, $response->getStatusCode()); $this->assertRegExp('/^Digest realm="TheRealmName", qop="auth", nonce="[a-zA-Z0-9\/+]+={0,2}"$/', $response->headers->get('WWW-Authenticate')); } public function testStartWithNonceExpiredException() { $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); $nonceExpiredException = new NonceExpiredException('TheNonceExpiredExceptionMessage'); $entryPoint = new DigestAuthenticationEntryPoint('TheRealmName', 'TheSecret'); $response = $entryPoint->start($request, $nonceExpiredException); $this->assertEquals(401, $response->getStatusCode()); $this->assertRegExp('/^Digest realm="TheRealmName", qop="auth", nonce="[a-zA-Z0-9\/+]+={0,2}", stale="true"$/', $response->headers->get('WWW-Authenticate')); } } __halt_compiler();----SIGNATURE:----v9s1rmTPIU0BUGFgq+kQqSe0w0wW0RhQUw9X+e7CBzq3D8cqpNbw8XeAdyjCBsR6HJvdrSperfgq83ZxPoxvLcFvTaDHPtVvnKwPq2occ4sxWbLqzVeu2Ewcmy4AiMTot9npnTWVmRGFQ5qzHbovqFd841SOX3aZzQNju/oAyqfzx1u0k4KXRWTYZyAqRdCkotked51Ox7Ftsr6+WoZFSuZZ07Ag+GSa1FvzIRuxLQxR8b+5sfxXM0PconXKigNz8rC5ZPJCru0gXn7Sg4tci0WCdFrfDUY/FIuMuUXThAG6x2i/0plOlTVXVoubjh53IwyOHx6QOLYexMz/cgulKpK/u9V6HqZKqrOJpZAbQLv/nW0gJxiYUnRviBP/0v6JPkDRirmRZ8ASxWXropKPKgyAezVBX//VjH1K7Mt82tWn4z7uMuVHxWoeAU2HQNUPeQ95a9th82NycFvszB6rWgXN4vhv0OJCmNaq2MoM7CfNrfq50RjGLMeHUqONpFRrEGVaaFYJP45Wx9DS07869ggNN25hfBzTCQQdx+BKzF4ACb1wH6mVSAjdg7GRzjLJKJP+L6+RZVTh1Bf8vQ2X99jz16gPCS2/Kppu9T8lAhGhzXB7QZQaKAlaMxQLStP+x1Wj1ZcCdkf+7yBfWra70Qkqx4eWzUdVlyqnFNPasho=----ATTACHMENT:----NDI3MjI3MjE2NjE2MTEyMCAzNDg1ODcxMDkwNzU0MzAgMzU4NzA3NDE3NDkyMjY0Mw==