DokuWiki

It's better when it's simple

User Tools

Site Tools


Sidebar

Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

Our Privacy Policy

auth:mysql_laconica

MySql DokuWiki/Laconica

Disclaimer: this procedure was based on the DokuWiki/ProjectPier page at mysql_projectpier

Laconica
This assumes that all user accounts will be created and maintained through Laconica.

Based on Laconica version 0.7.1
DokuWiki version 2009-02-14

MySql authentication in Laconica

Laconica stores passwords as md5($password . $id) (for details see lib/utils.php in laconica source), so DokuWiki needs to forward the clear password.

DokuWiki changes

the file conf/mysql.conf.php:

/* Options to configure database access. You need to set up this
 * options carefully, otherwise you won't be able to access you
 * database.
 */
$conf['passcrypt'] = 'md5';
$conf['auth']['mysql']['server']   = '';
$conf['auth']['mysql']['user']     = '';
$conf['auth']['mysql']['password'] = '';
$conf['auth']['mysql']['database'] = '';
 
/* This option enables debug messages in the mysql module. It is
 * mostly usefull for system admins.
 */
$conf['auth']['mysql']['debug'] = 0;
 
/* Normally password encryption is done by DokuWiki (recommended) but for
 * some reasons it might be useful to let the database do the encryption.
 * Set 'forwardClearPass' to '1' and the cleartext password is forwarded to
 * the database, otherwise the encrypted one.
 */
$conf['auth']['mysql']['forwardClearPass'] = 1;
 
/***********************************************************************/
/*       Basic SQL statements for user authentication (required)       */
/***********************************************************************/
 
/* This statement is used to grant or deny access to the wiki. The result
 * should be a table with exact one line containing at least the password
 * of the user. If the result table is empty or contains more than one
 * row, access will be denied.
 *
 * The module access the password as 'pass' so a alias might be necessary.
 *
 * Following patters will be replaced:
 *   %{user}    user name
 *   %{pass}    encrypted or clear text password (depends on 'encryptPass')
 *   %{dgroup}  default group name
 */
$conf['auth']['mysql']['checkPass']   = "SELECT password AS pass, id AS id
                                         FROM user AS ug
                                         WHERE nickname='%{user}'
                                         AND password=MD5(CONCAT('%{pass}', id))
                                         ";
 
/* This statement should return a table with exact one row containing
 * information about one user. The field needed are:
 * 'pass'  containing the encrypted or clear text password
 * 'name'  the user's full name
 * 'mail'  the user's email address
 *
 * Keep in mind that DokuWiki will access this information through the
 * names listed above so aliases might be necessary.
 *
 * Following patters will be replaced:
 *   %{user}    user name
 */
$conf['auth']['mysql']['getUserInfo'] = "SELECT password AS pass, nickname AS name, email AS mail
                                         FROM user
                                         WHERE nickname='%{user}'";

ToDo

  • Share Cookie
  • what about OpenID Users in Laconica? They don't necessarily have a password stored

Igorette 2009-03-01

auth/mysql_laconica.txt · Last modified: 2011-06-18 16:32 by ach