auth:xmpp
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
auth:xmpp [2010-02-17 16:52] – 77.72.19.231 | auth:xmpp [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== XMPP/Jabber authentication | ||
- | ===== Incompatibility with the current version of DokuWiki ===== | ||
- | |||
- | * Tried to use both variants on DokuWiki version 2009-12-25c " | ||
- | |||
- | ===== What does it do? ===== | ||
- | |||
- | It authenticates users by logging into an XMPP server. This was originally conceived in order to have a website authenticate against email accounts set up on Gmail for a whole domain. It's really incomplete and " | ||
- | |||
- | ===== Requirements ===== | ||
- | |||
- | * XMPPHP (http:// | ||
- | |||
- | ===== Installation ===== | ||
- | |||
- | Paste the code into " | ||
- | |||
- | $conf[' | ||
- | |||
- | And remember to alter " | ||
- | |||
- | ===== Code ===== | ||
- | |||
- | <code php> | ||
- | <?php | ||
- | /** | ||
- | * XMPP/Jabber authentication backend | ||
- | * | ||
- | * http:// | ||
- | * | ||
- | * XMPPHP from http:// | ||
- | * for this to work at all. | ||
- | * | ||
- | * @license | ||
- | * @author | ||
- | */ | ||
- | |||
- | include ' | ||
- | |||
- | $server = ' | ||
- | $port = 5222; | ||
- | $domain = ' | ||
- | |||
- | // we only accept page ids for auth_plain | ||
- | if(isset($_REQUEST[' | ||
- | $_REQUEST[' | ||
- | |||
- | /** | ||
- | * Check user+password [required auth function] | ||
- | * | ||
- | * Checks if the given user exists and the given | ||
- | * plaintext password is correct by trying to | ||
- | * connect to and authenticate against an xmpp | ||
- | * server. | ||
- | * | ||
- | * @author | ||
- | * @return | ||
- | */ | ||
- | function auth_checkPass($user, | ||
- | global $server; | ||
- | global $port; | ||
- | global $domain; | ||
- | |||
- | $conn = new XMPPHP_XMPP($server, | ||
- | |||
- | try { | ||
- | $conn-> | ||
- | $conn-> | ||
- | $conn-> | ||
- | return true; | ||
- | } catch(XMPPHP_Exception $e) { | ||
- | return false; | ||
- | } | ||
- | } | ||
- | |||
- | /** | ||
- | * Return user info [required auth function] | ||
- | * | ||
- | * Returns info about the given user needs to contain | ||
- | * at least these fields: | ||
- | * | ||
- | * name string | ||
- | * mail string | ||
- | * grps array list of groups the user is in | ||
- | * | ||
- | * No group support yet. | ||
- | * | ||
- | * @author | ||
- | */ | ||
- | function auth_getUserData($user){ | ||
- | $userinfo = array (" | ||
- | return $userinfo; | ||
- | } | ||
- | |||
- | /** | ||
- | * Create a new User [required auth function] | ||
- | * | ||
- | * Returns false if the user already exists, null when an error | ||
- | * occurred and the cleartext password of the new user if | ||
- | * everything went well. | ||
- | * | ||
- | * This obviously always returns null, since sane admins | ||
- | * have account creation disabled on XMPP servers. | ||
- | * | ||
- | * @author | ||
- | */ | ||
- | function auth_createUser($user, | ||
- | msg(' | ||
- | return null; | ||
- | } | ||
- | |||
- | //Setup VIM: ex: et ts=2 enc=utf-8 : | ||
- | |||
- | </ | ||
- | |||
- | ===== Alternate Code ===== | ||
- | |||
- | The above doesn' | ||
- | |||
- | <code php> | ||
- | <?php | ||
- | /** | ||
- | * XMPP/Jabber authentication backend | ||
- | * | ||
- | * http:// | ||
- | * | ||
- | * XMPPHP from http:// | ||
- | * for this to work at all. | ||
- | * | ||
- | * @license | ||
- | * @author | ||
- | * @author | ||
- | * @author | ||
- | * @author | ||
- | */ | ||
- | |||
- | define(' | ||
- | require_once(DOKU_AUTH.'/ | ||
- | |||
- | require_once("/ | ||
- | |||
- | class auth_xmpp extends auth_basic { | ||
- | |||
- | var $server = " | ||
- | var $port = 5222; | ||
- | var $domain = " | ||
- | |||
- | /** | ||
- | * Constructor | ||
- | * | ||
- | * checks if the mysql interface is available, otherwise it will | ||
- | * set the variable $success of the basis class to false | ||
- | * | ||
- | * @author Matthias Grimm < | ||
- | * @author Paul Thomas < | ||
- | */ | ||
- | function auth_xmpp() { | ||
- | global $conf; | ||
- | if (method_exists($this, | ||
- | parent:: | ||
- | |||
- | } | ||
- | /** | ||
- | * Checks if the given user exists and the given plaintext password | ||
- | * is correct. Furtheron it might be checked wether the user is | ||
- | * member of the right group | ||
- | * | ||
- | * Depending on which SQL string is defined in the config, password | ||
- | * checking is done here (getpass) or by the database (passcheck) | ||
- | * | ||
- | * @param | ||
- | * @param | ||
- | * @return bool | ||
- | * | ||
- | * @author | ||
- | * @author | ||
- | * @author | ||
- | */ | ||
- | function checkPass($user, | ||
- | $conn = new XMPPHP_XMPP($this-> | ||
- | |||
- | try { | ||
- | $conn-> | ||
- | $conn-> | ||
- | $conn-> | ||
- | $this-> | ||
- | return true; | ||
- | } | ||
- | catch (XMPPHP_Exception $e) { | ||
- | $this-> | ||
- | return false; | ||
- | } | ||
- | return false; | ||
- | } | ||
- | |||
- | function getUserData($user){ | ||
- | $userinfo = array (" | ||
- | return $userinfo; | ||
- | } | ||
- | } | ||
- | |||
- | </ |
auth/xmpp.1266421955.txt.gz · Last modified: 2010-02-17 16:52 by 77.72.19.231