[Security] removed the 401 error custom status message
This commit is contained in:
parent
f61457d82b
commit
e19359060f
@ -34,7 +34,7 @@ class BasicAuthenticationEntryPoint implements AuthenticationEntryPointInterface
|
||||
{
|
||||
$response = new Response();
|
||||
$response->headers->set('WWW-Authenticate', sprintf('Basic realm="%s"', $this->realmName));
|
||||
$response->setStatusCode(401, $authException ? $authException->getMessage() : null);
|
||||
$response->setStatusCode(401);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class DigestAuthenticationEntryPoint implements AuthenticationEntryPointInterfac
|
||||
|
||||
$response = new Response();
|
||||
$response->headers->set('WWW-Authenticate', $authenticateHeader);
|
||||
$response->setStatusCode(401, $authException ? $authException->getMessage() : null);
|
||||
$response->setStatusCode(401);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ class BasicAuthenticationEntryPointTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertEquals('Basic realm="TheRealmName"', $response->headers->get('WWW-Authenticate'));
|
||||
$this->assertEquals(401, $response->getStatusCode());
|
||||
$this->assertAttributeEquals('The exception message', 'statusText', $response);
|
||||
}
|
||||
|
||||
public function testStartWithoutAuthException()
|
||||
@ -47,6 +46,5 @@ class BasicAuthenticationEntryPointTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertEquals('Basic realm="TheRealmName"', $response->headers->get('WWW-Authenticate'));
|
||||
$this->assertEquals(401, $response->getStatusCode());
|
||||
$this->assertAttributeEquals('Unauthorized', 'statusText', $response);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ class DigestAuthenticationEntryPointTest extends \PHPUnit_Framework_TestCase
|
||||
$response = $entryPoint->start($request, $authenticationException);
|
||||
|
||||
$this->assertEquals(401, $response->getStatusCode());
|
||||
$this->assertAttributeEquals('TheAuthenticationExceptionMessage', 'statusText', $response);
|
||||
$this->assertRegExp('/^Digest realm="TheRealmName", qop="auth", nonce="[a-zA-Z0-9\/+]+={0,2}"$/', $response->headers->get('WWW-Authenticate'));
|
||||
}
|
||||
|
||||
@ -46,7 +45,6 @@ class DigestAuthenticationEntryPointTest extends \PHPUnit_Framework_TestCase
|
||||
$response = $entryPoint->start($request);
|
||||
|
||||
$this->assertEquals(401, $response->getStatusCode());
|
||||
$this->assertAttributeEquals('Unauthorized', 'statusText', $response);
|
||||
$this->assertRegExp('/^Digest realm="TheRealmName", qop="auth", nonce="[a-zA-Z0-9\/+]+={0,2}"$/', $response->headers->get('WWW-Authenticate'));
|
||||
}
|
||||
|
||||
@ -60,7 +58,6 @@ class DigestAuthenticationEntryPointTest extends \PHPUnit_Framework_TestCase
|
||||
$response = $entryPoint->start($request, $nonceExpiredException);
|
||||
|
||||
$this->assertEquals(401, $response->getStatusCode());
|
||||
$this->assertAttributeEquals('TheNonceExpiredExceptionMessage', 'statusText', $response);
|
||||
$this->assertRegExp('/^Digest realm="TheRealmName", qop="auth", nonce="[a-zA-Z0-9\/+]+={0,2}", stale="true"$/', $response->headers->get('WWW-Authenticate'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user