Log into my MediaWiki site when specific users are

2019-08-17 07:37发布

问题:

I have a ASP.NET/C# website using IIS that when a user logs in successfully (Using login control and checking oracle table for user info) I create a session variable that lets the site know the user is authenticated. I have also created a Wiki site using Media Wiki which I have hosted on a different web server. I'm going to link to the Wiki from my main website where the user logged in.

What I need to do is when a specific users log into my main site I want them to be logged into my Wiki site as well when they navigate to that page. I want them to be able to edit the Wiki without having to log in again.

This will only be for a handful of people that will be flagged in my user table on my main site and already have user accounts on my Wiki site. What would be the best approach?

I did read the information on the Media Wiki website and it wasn't helpful for IIS and how to set it up. For MediaWiki to know what user I want to have be logged in to I have to manually set the remote_user enviroment variable or can I tell MediaWiki to look for my session variable value?

回答1:

The internal MediaWiki mechanism for this is the SessionProvider (somewhat complex and the documentation is highly technical). A simple implementation that just pushes the burden of authentication to the web server software is the Auth remoteuser extension.

Otherwise, if you share a domain, you could set cookies in your primary application in some kind of verifiable fashion (e.g. digitally signed) and verify them on your wiki. If you don't, the wiki will have to trigger a web request to the primary application, which would check the cookie and respond with an authentication status, and the wiki would set its cookies based on that.