Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
auth:imap for weatherwax
plugin for authentication via POP3/IMAP
moto #1
Member since May 2013 · 1 post · Location: Tokyo JAPAN
Group memberships: Members
Show profile · Link to this post
Subject: auth:imap for weatherwax

Thank you very much for such a nice wiki program!!

Yesterday I updated my installation to weatherwax, the realized I need to have a newer version of auth:imap ([]=auth&s[]=imap) since weatherwax required another style of authentication plugin.
And I wanted some pastime at that time, so I tried.
Please use it if you like.

Thank you very much.

// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();

 * POP3/IMAP authentication plugin for DokuWiki
 *     copyright (c) by moto kawasaki <>
 * @license     Choose one of FreeBSD or GPL3.
 *              FreeBSD (
 *              GPL3    (
 * @author      moto kawasaki <>

// You need to choose this plugin as authtype in $DOKU_ROOT/conf/local.php.
//     $conf['authtype'] = 'authmkpop3';
// Also you may need to set authserver parameter.
// This is the first argument 'string $mailbox' for imap_open().
//     $conf['plugin']['authmkpop3']['authserver'] = '{}';
// authserver has default value of '{}'. See ./conf/default.php
// Then, create/modify/delete DokuWiki users in Admin Panel, except for
// the password which is stored in POP3/IMAP server side and thus you cannot
// store/modify at the DokuWiki side.
// authmkpop3 tries to connect $authserver using imap_open(),
// and $user + $passwd taken from user input at the login panel,
// and return true/false accroding to the result of POP3/IMAP authentication.
// Please note that authmkpop3 is extended from authplain, so most features of
// the authplain plugin are available in authmkpop3 too.
// The major differences are 1) configuration parameters and 2) inability on
// the passwd described above.

class auth_plugin_authmkpop3 extends auth_plugin_authplain {

    protected $server = null; // expects string $mailbox for imap_open().

    public function __construct() {

        if(!function_exists('imap_open')) {
            $this->debug("authmkpop3 err: PHP IMAP extension not found.",
                         -1, __LINE__, __FILE__);
            $this->sucess = false;

        if(!($this->server = $this->getConf('authserver'))) {
            $this->debug("authmkpop3 err: insufficient configuration.",
                         -1, __LINE__, __FILE__);
            $this->success = false;

        $this->cando['addUser']      = true;
        $this->cando['delUser']      = true;
        $this->cando['modLogin']     = true;
        $this->cando['modPass']      = false;
        $this->cando['modName']      = true;
        $this->cando['modMail']      = true;
        $this->cando['modGroups']    = true;
        $this->cando['getUsers']     = true;
        $this->cando['getUserCount'] = true;
        $this->cando['GetGroups']    = true;
        $this->cando['external']     = false;
        $this->cando['logout']       = true;

        $this->success = true;

    public function checkPass($user, $pass) {

        $userinfo = $this->getUserData($user);
        if ($userinfo == false) {
            return false;

        if (!($handle = imap_open($this->server, $user, $pass))) {
            return false;
        } else {
        return true;

configuration should be something like the following in local.php
$conf['authtype'] = 'authmkpop3';
$conf['plugin']['authmkpop3']['authserver'] = '{}';
This post was edited on 2013-05-24, 07:59 by moto.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-04-06, 04:35:07 (UTC +02:00)