我正在尝试按照此示例实施 CakePHP Ldap 身份验证,但出现此错误:
Strict (2048):LdapAuthenticate::getUser() 的声明应与 BaseAuthenticate::getUser(CakeRequest $request) [APP\Plugin\Idbroker\Controller\Component\Auth\LdapAuthenticate.php,第 5 行] 兼容
错误的上下文是:
App::uses('BaseAuthenticate', 'Controller/Component/Auth');
class LdapAuthenticate extends BaseAuthenticate {
$className = 'LdapAuthenticate'
$parts = array(
(int) 0 => 'Idbroker',
(int) 1 => 'Controller/Component/Auth'
)
$plugin = 'Idbroker'
$package = 'Controller/Component/Auth'
$file = ...Plugin\Idbroker\Controller\Component\Auth\LdapAuthenticate.php'
$paths = array(
(int) 0 => ...Plugin\Idbroker\Controller\Component\Auth\',
(int) 1 => ...Plugin\Idbroker\Lib\Controller/Component/Auth\',
(int) 2 => ...Plugin\Idbroker\Controller/Component/Auth\'
)
$pluginPath = 'C:\csvn\www\KMDEV\app\Plugin\Idbroker\'
$normalizedClassName = 'LdapAuthenticate'
$path = '...Plugin\Idbroker\Controller\Component\Auth\'
include '...Plugin\Idbroker\Controller\Component\Auth\LdapAuthenticate.php line 5
App::load() - CORE\Cake\Core\App.php, line 561
spl_autoload_call - [internal], line ??
class_exists - [internal], line ??
我可以看到它与 PHP 和 CakePHPLdapAuthenticate::getUser()
没有相同的签名,
BaseAuthenticate::getUser(CakeRequest $request)
但对 PHP 和 CakePHP 来说太新了,无法知道修复它的最佳方法。示例中的步骤看起来很简单。我与示例的唯一不同之处是在 App/Config/database.php 中,我更改了内容(主机、端口等)以匹配我的 Web 服务器和 App/Config/ldap.php,在其中我删除了除此之外的所有内容:
<?php
$config['LDAP']['Db']['Config'] = 'ldap';
$config['LDAP']['User']['Identifier'] = 'samAccountName';
我正在使用的 CakePHP 2.0 示例应该与当前版本的 CakePHP (2.3.1) 一起使用吗?有什么我错过的吗?还有另一种更简单的方法来让 CakePHP Ldap 身份验证工作吗?