Share user login/session between cakephp and moodl

2019-08-08 06:42发布

问题:

I have a website already running made with CakePHP, which has its own login system using the Auth component.

Now I'm going to create another website using moodle, hosted in the same server. Is there any way to share the user session between those 2 websites?

For example, if a user logs into the moodle website and clicks a link to a page of the other website, he is not asked to log in again, since the system recognises that he is already logged in.

I guess that one thing to do would be to tell moodle (somehow) to use same table of users in the database that the CakePHP website is already using. And then tell the CakePHP website to accept the sessions created in that other website. Something like this right?

But I don't know how to do those things or if they even possible, any advice on how to approach this would be very helpful.

回答1:

Single sign-on (SSO) is not currently a trivial thing to do in Moodle.

Some other approaches you may consider are:

  • Use external authentication in Moodle and configure it to use Cake's database. Does not provide SSO but tells Moodle to use Cake's user accounts.

  • Configure both Moodle and Cake to use a common authentication system like LDAP, POP3 or CAS. Depending of your choice it is possible that you may achieve SSO.

More information about Moodle authentication plug-ins in this page:

http://docs.moodle.org/dev/Authentication_plugins