我正在尝试编写一个单点登录扩展,这样具有正确权限的MediaWiki用户就不需要登录到我们的Joomla2.5。我无法让它工作,因为onAfterInitialise事件不会触发(如果我尝试使用这些事件,onAfterRoute或onAfterDispatch也不会触发)。我知道这个扩展实际上正在运行,因为onUserAuthentication事件正在触发并以我的测试用户身份登录。
下面是两个事件的代码,第一个事件不会触发并执行die()语句,第二个事件在登录后触发并无条件地验证我的身份。
有什么是我在这里遗漏的,比如一个扩展不能使用两种不同类型的事件或什么的?
class plgAuthenticationMwSSO extends JPlugin {
function __construct( &$subject, $config ) {
parent::__construct( $subject, $config );
}
public function onAfterInitialise() {
die('testing');
}
public function onUserAuthenticate( $creds, $opt, &$response ) {
$response->username = 'Foo';
$response->fullname = 'Foo Bar';
$response->email = 'foo@bar.baz';
$response->status = JAuthentication::STATUS_SUCCESS;
$response->error_message = '';
}
}发布于 2015-08-15 01:11:49
您需要将onAfterInitialise放在一个系统插件中。作为一个平行的例子,注意如何记住插件是一个系统插件,然后Cookie插件是一个插件。在堆栈中很早就会检查系统插件,并且在每次页面加载时都会进行检查。身份验证插件在身份验证启动时进行检查,并在特定时间作为一个组专门加载。因为您有一个身份验证插件,所以不会在正确的时间触发它来响应您正在寻找的系统事件。
https://stackoverflow.com/questions/31999840
复制相似问题