开发者

Where are MediaWiki's sessions set?

开发者 https://www.devze.com 2023-01-29 18:34 出处:网络
I have my own login system, and I want MediaWiki to share the same session. I\'m trying to ha开发者_如何转开发ve my login system automatically login to my MediaWiki too which means I would probably ha

I have my own login system, and I want MediaWiki to share the same session. I'm trying to ha开发者_如何转开发ve my login system automatically login to my MediaWiki too which means I would probably have to share the same user database too.

Advice?


Not sure if this is exactly what you want, but we use LDAP Authentication.


The session is set in includes/GlobalFunctions.php. If you want to fake a user login to mediawiki after the user logs in to your system, you'll need to make sure that the cookie parameters match (e.g. the cookie URL must be the same); have a look at the arguments they use to construct it in the call to session_set_cookie_params.

Once you've got the session set up correctly, you'll need to load a user and inject it to the session so that when mediawiki goes to check if the user is logged in, it finds your injected user and goes right ahead. Look in includes/User.php, the User::loadFromSession call looks like a promising place to figure out what they expect to find there.


If you make changes directly to the MediaWiki source, you'll have a hard time upgrading to future versions of MediaWiki. It would be much better to use the existing authentication plugin framework:

http://www.mediawiki.org/wiki/AuthPlugin

You didn't specify what your existing login system is, but if you're lucky somebody has already built a plugin for it:

http://www.mediawiki.org/wiki/Category:User_identity_extensions

0

精彩评论

暂无评论...
验证码 换一张
取 消