===== SSO =====
==== Workflow ====
The recommended SSO strategy is to keep original application user management, and code support for La Distribution in a plugin.
The common workflow is:
* Check if user is authenticated.
* If it is authenticated, check if user is registered in local application
* If it is not registered, register it
* Then, use the local application session mechanism to set that the user is authenticated
Additionally you may implement user login, logout.
==== Methods ====
Main SSO related methods are located in this class.
http://ladistribution.net/trac/browser/trunk/lib/Ld/Auth.php
Check if user is already authenticated:
Ld_Auth:isAuthenticated()
Get current user infos:
Ld_Auth:getUser();
Get current user username:
Ld_Auth:getUsername();
Try to log in user with username and password:
$result = Ld_Auth::authenticate($user, $pass);
if ($result->isValid()) {
// code here
} else {
// code here
}
Log user out:
Ld_Auth::logout();
==== Examples ====
* [[http://ladistribution.net/trac/browser/trunk/packages/wordpress/application/plugins/ld-auth.php|WordPress]]
* [[http://ladistribution.net/trac/browser/trunk/packages/dokuwiki/application/auth/ld.class.php|DokuWiki]]
* [[http://ladistribution.net/trac/browser/trunk/packages/bbpress/application/plugins/ld.auth.php|bbPress]]
* [[http://ladistribution.net/trac/browser/trunk/packages/firefox-sync/application/auth/ld.php|Firefox Sync]]
* [[http://ladistribution.net/trac/browser/trunk/packages/statusnet/application/plugins/LdAuthenticationPlugin.php
|Status.net]]