/**
  * According to RFC 2617 (http://www.ietf.org/rfc/rfc2617.txt), the 401 response message MUST
  * contain a WWW-Authenticate header
  *
  * {@inheritDoc}
  */
 public function prepareResponse(HttpResponse $response)
 {
     parent::prepareResponse($response);
     $headers = $response->getHeaders();
     $challenge = $this->getChallenge();
     $authenticateHeader = Header\WWWAuthenticate::fromString("WWW-Authenticate: {$challenge}");
     $headers->addHeader($authenticateHeader);
 }
示例#2
0
 public function testWWWAuthenticateFromStringCreatesValidWWWAuthenticateHeader()
 {
     $wWWAuthenticateHeader = WWWAuthenticate::fromString('WWW-Authenticate: xxx');
     $this->assertInstanceOf('Zend\\Http\\Header\\HeaderInterface', $wWWAuthenticateHeader);
     $this->assertInstanceOf('Zend\\Http\\Header\\WWWAuthenticate', $wWWAuthenticateHeader);
 }