Extension:WSOAuth/For developers

This page explains how to develop and add a new OAuth provider to WSOAuth.

Creating an OAuth provider for WSOAuth
Authentication plugins must live in the  namespace, implement the   interface and extend the   class provided by WSOAuth and must implement at least the following methods:


 * This function is called to send an authorization request to the OAuth application and redirect the user when they are not logged in.
 * Must return true if the authorization grant has been successfully received, else it must return false.
 * Usually, this function sends an authorization request to the OAuth provider and stores the received authorization grant in a session variable.
 * Usually, this function redirects the user to the authorization URL.

An example implementation of this function:


 * Called when the user logs out to notify the OAuth provider, if necessary, that clean up such as removing the user's session can be performed.
 * This function shadows PluggableAuth's function.


 * This function is called whenever a user tries to log in.
 * The purpose of this function is to retrieve the user info from the session variables set during.
 * This function must return an array with the following format if the user info could be retrieved from the session variables set during the  step of the authentication:
 * If the user has not been authenticated yet (i.e.  has not been performed, or the login failed), the function should return an empty array.
 * If the request failed, or the user is not authorised to log in, the function must return false.

An example implementation of this function:


 * Called after a new user has been authenticated and added to the database to add any additional information to the database required by the OAuth provider.
 * This function shadows PluggableAuth's function.

Adding a new OAuth provider to WSOAuth
You can add the OAuth provider you have developed to WSOAuth by placing the class you have written inside of. You must then update  and  :