2011-11-22 225 views
1

我將CakePHP 1.3應用程序升級到2.0.3。CakePHP 2.0身份驗證和基本身份驗證

以前,我能夠使用Auth組件來登錄用戶,並使用Security組件模擬Basic HTTP身份驗證。 (我彷彿設置.htaccess文件密碼保護的網頁)

我曾經這樣做:

$this->Security->loginOptions = array('type'=>'basic','realm'=>'training'); 
$this->Security->loginUsers = array("student"=>"student2010"); 
$this->Security->requireLogin(); 

現在看來,即使我用:

public $components = array(
     'Auth' => array(
      'authenticate' => array('Basic') 
     ) 
    ); 

它仍然想要使用我的用戶模型和數據庫。我錯過了什麼嗎?

回答

0

望着BaseAuthenticateBasicAuthenticate班會建議蛋糕不再支持定義用戶名和密碼的方式。

你可能會不得不延長BasicAuthenticate類並重寫它的的getUser()方法。

也許別人可以對此有所瞭解?

+0

是的,這是一個考慮因素。我可能最終會這樣做。 –