Changeset 7016eb4cb4364248b02c2b3336aff5da9a22e032

Show
Ignore:
Timestamp:
02/04/12 10:56:10 (4 months ago)
Author:
Xemle <xemle@phtagr.org>
Children:
33295e2f6bf20f39b0391fe58f4b96f0d18e8667
Parents:
863220d612ed27e28b1e8e1f6e4c3d95efb8d35f
git-committer:
Xemle <xemle@phtagr.org> / 2012-02-04T10:56:10Z+0100
Message:

Fix digest authentication for CakePHP 2.0

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Controller/Component/DigestAuthComponent.php

    rbfbeeb6 r7016eb4  
    8888     
    8989    Logger::trace("Add authentications header"); 
    90     header('WWW-Authenticate: Digest realm="'.$this->realm.'",qop="auth",nonce="'.uniqid().'",opaque="'.$opaque.'",algorithm="MD5"'); 
     90    $this->controller->response->header('WWW-Authenticate', 'Digest realm="'.$this->realm.'",qop="auth",nonce="'.uniqid().'",opaque="'.$opaque.'",algorithm="MD5"'); 
    9191  } 
    9292 
     
    9999      $this->__addDigestRequestHeader(); 
    100100    } 
     101    $this->controller->response->statusCode(401); 
    101102    $this->controller->redirect(null, 401, true); 
    102103  } 
     
    258259    } 
    259260    $this->Session->id($sid); 
    260     $this->Session->start(); 
    261261 
    262262    if (!$this->Session->check('auth.nc')) { 
     
    271271    $snc=$this->Session->read('auth.nc'); 
    272272    $nc=hexdec($this->_authData['nc']); 
    273     if ($snc==$nc) 
     273    if ($snc==$nc) { 
    274274      Logger::warn("Same request counter $snc is used!"); 
     275    } 
    275276   
    276277    // Check request counter