简体   繁体   English

Joomla身份验证插件

[英]Joomla Authentication Plugin

I've created a joomla plugin to authenticate same like normal joomla authentication, (intention is: i'm using civicrm on top of joomla, so based on civicrm membership status i want to update joomla user group for that user). 我已经创建了一个joomla插件来进行身份验证,就像正常的joomla身份验证一样(意图是:我在joomla上使用civicrm,所以根据civicrm成员资格状态,我想为该用户更新joomla用户组)。 Its working fine on plain joomla and Civicrm version(2.5.24). 它在普通joomla和Civicrm版本(2.5.24)上运行良好。

When I tried the same plugin on my existing client site(2.5.20), its authenticating using joomla defualt authenticaiton and not using my plugin. 当我在现有客户端站点(2.5.20)上尝试使用相同的插件时,使用joomla defualt认证进行身份验证,而不是使用我的插件。 I've installed my plugin and enabled it. 我安装了我的插件并启用了它。 but its not picking my authentication plugin. 但它没有选择我的身份验证插件。

Interestingly when I'm entering wrong user name or password its coming into my plugins "onUserAuthenticate" method. 有趣的是,当我输入错误的用户名或密码时,它进入我的插件“onUserAuthenticate”方法。 how can I get my plugin's "onUserAuthenticate" method works for all the time.. 如何让我的插件的“onUserAuthenticate”方法始终有效..

Thanks for your valuable support!! 感谢您的宝贵支持!

I think the way Joomla authenticate user is that it use all enabled authentication plugin to authenticate your username/password. 我认为Joomla对用户进行身份验证的方式是它使用所有已启用的身份验证插件来验证您的用户名/密码。

If you want your plugin work all the time, you can disable other plugins. 如果您希望您的插件始终有效,则可以禁用其他插件。 So Joomla will alway fall to your onUserAuthenticate method. 所以Joomla总会落到你的onUserAuthenticate方法上。 But note: This only work if your site does not need any other authentication plugins . 但请注意: 这仅在您的站点不需要任何其他身份验证插件时才有效

From joomla docs 来自joomla docs

In order for successful authentication to occur, only one of the plugins needs to return a JAUTHENTICATE_STATUS_SUCCESS result. 为了成功进行身份验证,只有一个插件需要返回JAUTHENTICATE_STATUS_SUCCESS结果。

Ref: https://docs.joomla.org/J3.x:Creating_an_Authentication_Plugin_for_Joomla#Wrapping_it_All_Up_and_Using_It 参考: https ://docs.joomla.org/J3.x : Creating_an_Authentication_Plugin_for_Joomla#Wrapping_it_All_Up_and_Using_It

I once had a request to build a joomla site but clients only want Joomla admin login on admin site , on front-End, only api user can login. 我曾经有过建立joomla网站的请求,但是客户只希望Joomla管理员在管理站点上登录,在前端,只有api用户可以登录。 What I did is I disable all authentication plugin on Joomla and create my own plugin which will check if user is on front end or back end. 我做的是我在Joomla上禁用所有身份验证插件并创建我自己的插件,该插件将检查用户是在前端还是后端。 I used joomla code for back-end logins and my code for front-end logins. 我使用joomla代码进行后端登录,使用我的代码进行前端登录。

It work perfectly. 它工作得很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM