merged branch fabpot/401-status-code (PR #5882)
This PR was merged into the master branch.
Commits
-------
e193590
[Security] removed the 401 error custom status message
Discussion
----------
[Security] removed the 401 error custom status message
see fabpot/Silex#496
---------------------------------------------------------------------------
by pborreli at 2012-10-31T17:29:24Z
@fabpot please fix the test suite, if you don't know how to do it, read http://symfony.com/doc/current/contributing/code/tests.html, thx 😸
This commit is contained in:
commit
f32395af69
@ -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