by Nathan Mcilree.
This is a replacement for a previous even hackier authentication method where on login to our bespoke system the username would be saved in a database with a guid key and then the user forwarded to a specific MOODLE key which would retrieve the user details from aforementioned database, used to log user into MOODLE, and then return user to bespoke system.
I am not sure if the Web Services provide authentication services - I did a quick search through the functions under for "auth" or "log" and came back with nothing.
I guess the proper way to do this would be to develop an auth plugin.
I implemented a slightly more hacky version for the company I work for which I will describe below in case it is of assistance.
Scenario
User logs onto our bespoke web platform , when they click across to MOODLE they are background authenticated at that point (or new account created if they do not have a local MOODLE account).
Process
- On login to our bespoke web platform cookie is assigned to user (this relies on shared sub domains - but other mechanisms could be substituted).
- When a user hits MOODLE config.php checks for this cookie - if present it makes note of page user was trying to go to and forwards user to custom background login page.
- Custom login page calls user details via our own web services using cookie as ID.
- User is loaded via a common id to both systems (we use id number as the shared field) using the MOODLE function :
$user = get_complete_user_data('idnumber', $returned_id); - If a result is returned then call MOODLE function
complete_user_login($user); - Following this the user is forwarded to the original page they were requesting.
This is a replacement for a previous even hackier authentication method where on login to our bespoke system the username would be saved in a database with a guid key and then the user forwarded to a specific MOODLE key which would retrieve the user details from aforementioned database, used to log user into MOODLE, and then return user to bespoke system.
Sorry if kind of track - but thought there might be a chance it is of use to you.