Joomla 3.2自定义身份验证,无需添加本地用户

时间:2014-04-04 07:53:57

标签: php authentication joomla3.2

我目前正在开发一个相当大的Joomla项目,需要外部用户身份验证(只有注册用户组,所以没有管理员或发布者等需要远程进行身份验证),它连接到外部数据库包含所有用户和密码。 为了实现这一点,我写了一个自定义Joomla身份验证插件。 每次我通过插件对用户进行身份验证时,Joomla会自动添加一个本地(joomla)用户,如果该用户尚不存在,则会自动添加该用户。

我的问题: 由于有很多用户(10000+)并且他们通过外部数据库管理区域,是否可以在不让Joomla添加本地用户的情况下对用户进行身份验证?

我的插件代码:

public function onUserAuthenticate($credentials, $options, &$response)
{
        // custom method, do stuff, connect to the database, check if username and password are correct, get user row
        $result = $this->getExtUser($credentials);

        if(!empty($result))
        {
            $response->type = 'myauth';
            $response->email = $result['email'];
            $response->status = JAuthentication::STATUS_SUCCESS;
        }
        else
        {
            $response->status = JAuthentication::STATUS_FAILURE;
        }
}

提前致谢!

0 个答案:

没有答案
相关问题