[cvs] [Wiki] created: CpanelAuthHowTo

Jan Schneider jan at horde.org
Wed Jul 11 09:52:21 UTC 2007


jan  Wed, 11 Jul 2007 02:52:21 -0700

Created page: http://wiki.horde.org/CpanelAuthHowTo

Save the following file (also attached to this page) to
{{horde/lib/Auth/cpanel.php}}:

<code type="php">
<?php

require_once dirname(__FILE__) . '/imap.php';

class Auth_cpanel extends Auth_imap {

    /**
     * Constructs a new cpanel authentication object.
     *
     * @param array $params  A hash containing connection parameters.
     */
    function Auth_cpanel($params = array())
    {
        $this->capabilities['transparent'] = true;
        parent::Auth_imap($params);
    }

    /**
     * Automatic authentication.
     *
     * @return boolean  Whether or not the client is allowed.
     */
    function transparent()
    {
        if ($this->_authenticate(getenv('REMOTE_USER'),
                                 array('password' =>
getenv('REMOTE_PASSWORD')))) {
            $this->setAuth(getenv('REMOTE_USER'),
                           array('transparent' => 1,
                                 'password' => getenv('REMOTE_PASSWORD')));
            return true;
        } else {
            return false;
        }
    }

}
</code>

The add the following line to {{horde/config/conf.php}} //after// the line
saying {{/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE.
*/}}:

<code type="php">
$conf['auth']['driver'] = 'cpanel';
</code>

Don't change anything else in the {{conf.php}} file.


More information about the cvs mailing list