Forums | Mahara Community
Developers
/
User authentication
07 July 2011, 16:44
Hi,
I am setting up a simple user authentication to allow users of our existing system to link to and seemlessly use Mahara. I can see there are various options to authenticate users via other 3rd party system, and various MySQL tables such as "sso_session" and "auth_remote_user" which I presume could be used for this.
Can anyone point me in the right direction to get started on the technical implementation of this?
Many thanks,
Tim
08 July 2011, 2:55
Hi Tim,
It's pretty easy to write your own authentication plugin for Mahara. This is almost certainly the route that you'll want to take.
I'm afraid that all of the documentation is within the php files themselves and is primarily in phpdoc format. I'd also advise using a similar auth plugin as a basis.
You'll need to create a folder (e.g. myauth) with at least the following files:
- lib.php
- version.php
- lang/en.utf8/auth.<myauth>.php
You version.php is pretty simple (see another plugin), and the language files should be fairly obvious too.
Your lib.php will need an Auth<myauth> class extending the Auth class which handles the actual login attempts; and a PluginAuth<myauth> class extending the PluginAuth class to handle configuration of the class.
The key areas you'll want to be looking at for documentation are in auth/lib.php -- see the Auth class, and PluginAuth class. I'd also recommend seeing how other plugins currently do so.
May I ask what you're planning to authenticate against?
All the best,
Andrew
11 July 2011, 5:55
Hi Andrew,
That's incredibly helpful - thank you. We have a single sign on system that we have developed for a medical school which they would now like to integrate into an installation of Mahara, so people can use this as an e-portfolio.
Many thanks,
Tim