* * 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:----RSEzdXhuEbnmXrLU/9ywrqf5+J7qtvOyHmOk1s+8I8xl10EfgjRu/XelClZPIjm13j6xHjJjqLJ4K1N7g9juDE/U9LL3WjN49BEkSINV5d9xAfDHuuqBBZXe5Apni7jKP0URg4klVkd9JlWNOroPNI/04FA7KIsGv1HnEFJPvxmPnKHxmfoLfkQHsVB79YJl00EEgZlvq4jZhSZ5zRXVRVAM0OcjYJ5ykmdWNOelnwuWR8RL3vmogwTGkaE3C7V6OYHgevJ2Yfkx5wQ8j4zJh9ezBIJ6kRIoqst4toeAwjovaLOAp90Uhw9xsi9l6ZzkLkI9Z2M/nrjb9uJuWqkKEEINNCYbKVl2BmYTAmXN5hBBCk1Cp1g732EPlg3OBtX2+qAk3VgO03KMptT+Kd1g86nRZMmB2oj6Mde2nosAIyV6FtBIOlXIS+q6PvHSKIRiWqK80gU11Rn6aiSxzrwz2Rejx50iFant7Pctmf/j4oDMod1fXhIiW/UZ4iPJQ1IaMf5ya9cfP8HC6iQths18SV98thIq7ma779Q4JxzALm5HdbLEIkzKjKOU9YUf9YMC22RIL+y7r3+pxQ8fcu9GJz9BkQfDztxi37YWOYkUkM2NVJWC86LuOzM+McaQRVLn3wfbt8Tv2dKMlyJtad2yJdXkIj/Qyi8/nKc/4Edix6A=----ATTACHMENT:----Mjk4MTg5NTk2ODQ1NTEyOSA5OTUzMDYzNDA5ODExNzc4IDUyOTMxNTc4ODM1OTg5NjQ=