Cakephp 3.1의 인증 구성 요소를 사용하여 다이제스트 인증을 만들려고하는데 문제가 있습니다. 아래의 코드를 사용하고 있으며 이전 팝업에서 올바른 사용자 이름과 암호를 입력 한 직후에 팝업되는 HTTP 인증 팝업을 가지고 있습니다. 그런 다음 취소를 누르면 Cake \ Auth \ BasicAuthenticate-> unauthenticated가됩니다.CakePHP 3의 다이제스트 인증
누군가 내가 잘못하고있는 것을 말해 줄 수 있습니까? 내가 디버그 - 키트 환경에서 검사 할 때 클라이언트 부분
public function digest(){
$http = new Client();
$response = $http->get('http://localhost/project/api/v1/users/view/22', [], [
'auth' => [
'type' => 'digest',
'username' => 'Digest',
'password' => 'my_password',
]
]);
에서 AppController.php
$this->loadComponent('Auth', [
'authorize' => 'Controller',
'loginRedirect' => [
'controller' => 'Users',
'action' => 'index'
],
'authenticate' => [
'Digest' => [
'fields' => ['username' => 'username', 'password' => 'digest_hash'],
'userModel' => 'Users',
],
],
'loginAction' => [
'controller' => 'Users',
'action' => 'login',
],
'storage' => 'Memory',
'unauthorizedRedirect' => false
]);
UserTable.php
public function beforeSave(Event $event)
{
$entity = $event->data['entity'];
// Make a password for digest auth.
$entity->digest_hash = DigestAuthenticate::password(
$entity->username,
$entity->plain_password,
env('SCRIPT_NAME')
);
return true;
}
,이 있습니다
PHP_AUTH_DIGEST username="Digest", realm="localhost", nonce="57ac3609a5b79", uri="/project/api/v1/users/view/22", response="af0e1fe455aa7f1475df715ef5231b56", opaque="421aa90e079fa326b6494f812ad13e79", qop=auth, nc=00000001, cnonce="0bb461453700ebc1"