Skip to content

Commit

Permalink
[Security] removed the 401 error custom status message
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Nov 6, 2012
1 parent f61457d commit e193590
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 7 deletions.
Expand Up @@ -34,7 +34,7 @@ public function start(Request $request, AuthenticationException $authException =
{
$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;
}
Expand Down
Expand Up @@ -57,7 +57,7 @@ public function start(Request $request, AuthenticationException $authException =

$response = new Response();
$response->headers->set('WWW-Authenticate', $authenticateHeader);
$response->setStatusCode(401, $authException ? $authException->getMessage() : null);
$response->setStatusCode(401);

return $response;
}
Expand Down
Expand Up @@ -34,7 +34,6 @@ public function testStart()

$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()
Expand All @@ -47,6 +46,5 @@ public function testStartWithoutAuthException()

$this->assertEquals('Basic realm="TheRealmName"', $response->headers->get('WWW-Authenticate'));
$this->assertEquals(401, $response->getStatusCode());
$this->assertAttributeEquals('Unauthorized', 'statusText', $response);
}
}
Expand Up @@ -34,7 +34,6 @@ public function testStart()
$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'));
}

Expand All @@ -46,7 +45,6 @@ public function testStartWithNoException()
$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'));
}

Expand All @@ -60,7 +58,6 @@ public function testStartWithNonceExpiredException()
$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'));
}
}

0 comments on commit e193590

Please sign in to comment.