1<?php
2/**
3 * DokuWiki LemonLDAP:NG authentication plugin
4 * https://www.dokuwiki.org/plugin:authlemonldap
5 *
6 *
7 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
8 * @author  David Kreitschmann
9 */
10
11// must be run within Dokuwiki
12if(!defined('DOKU_INC')) die();
13
14
15class auth_plugin_authlemonldap extends DokuWiki_Auth_Plugin {
16
17  public function __construct() {
18    global $conf;
19    parent::__construct();
20    $this->cando['logout'] = false;
21    $this->cando['external'] = true;
22  }
23
24  public function trustExternal($user, $pass, $sticky = false) {
25    global $USERINFO;
26    if (isset($_SERVER['HTTP_AUTH_USER'])) {
27      $_SERVER['REMOTE_USER'] = $_SERVER['HTTP_AUTH_USER'];
28      $USERINFO['name'] = $_SERVER['HTTP_AUTH_CN'];
29      $USERINFO['mail'] = $_SERVER['HTTP_AUTH_MAIL'];
30      $USERINFO['grps'] = explode(';', str_replace("; ", ";", base64_decode($_SERVER['HTTP_AUTH_GROUPS'])));
31      return true;
32    }
33    return false;
34  }
35
36  public function useSessionCache($user) {
37    return false;
38  }
39}
40
41