DokuWiki

It's better when it's simple

User Tools

Site Tools


auth:ntlm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
auth:ntlm [2011-06-18 15:00]
ach corrected link
auth:ntlm [2016-01-20 08:31] (current)
77.40.51.212
Line 80: Line 80:
  $_REQUEST['p'] = $_SERVER['PHP_AUTH_PW'];  $_REQUEST['p'] = $_SERVER['PHP_AUTH_PW'];
  }  }
-  +  
 +}
 </code> </code>
  
Line 201: Line 202:
   * [[http://www.freelists.org/archives/dokuwiki/05-2005/msg00220.html|Krzysztof Kowalczyk's NTLM patch]]   * [[http://www.freelists.org/archives/dokuwiki/05-2005/msg00220.html|Krzysztof Kowalczyk's NTLM patch]]
   * [[http://www.shog9.com/log/archives/7-Painless-NTLM-authentication-in-Firefox.html|Painless NTLM authentication in Firefox]]   * [[http://www.shog9.com/log/archives/7-Painless-NTLM-authentication-in-Firefox.html|Painless NTLM authentication in Firefox]]
 +
 +===== Additions =====
 +
 +Using NTLM based auth and as user store the users.auth.php, you need to add the following code from plain.class.php:
 +
 +<code php>
 +    /**
 +     * Return user info
 +     *
 +     * Returns info about the given user needs to contain
 +     * at least these fields:
 +     *
 +     * name string  full name of the user
 +     * mail string  email addres of the user
 +     * grps array   list of groups the user is in
 +     *
 +     * @author  Andreas Gohr <andi@splitbrain.org>
 +     */
 +    function getUserData($user){
 +
 +      if($this->users === null) $this->_loadUserData();
 +      return isset($this->users[$user]) ? $this->users[$user] : false;
 +    }
 +
 +
 +    function _loadUserData(){
 +      global $config_cascade;
 +
 +      $this->users = array();
 +
 +      if(!@file_exists($config_cascade['plainauth.users']['default'])) return;
 +
 +      $lines = file($config_cascade['plainauth.users']['default']);
 +      foreach($lines as $line){
 +        $line = preg_replace('/#.*$/','',$line); //ignore comments
 +        $line = trim($line);
 +        if(empty($line)) continue;
 +
 +        $row    = explode(":",$line,5);
 +        $groups = array_values(array_filter(explode(",",$row[4])));
 +
 +        $this->users[$row[0]]['pass'] = $row[1];
 +        $this->users[$row[0]]['name'] = urldecode($row[2]);
 +        $this->users[$row[0]]['mail'] = $row[3];
 +        $this->users[$row[0]]['grps'] = $groups;
 +      }
 +    }
 +
 +</code>
 +
 +and comment the function getUserData from original ntlm.class.php
 +
 +<code php>
 +//function getUserData($user) {
 +//  global $conf;
 +//  $userInfo['name'] = niceNtlmUserName($user);
 +//  $userInfo['mail'] = $userInfo['name'].'@solvay.com';
 +//  $userInfo['grps'] = array($conf['defaultgroup']);
 +//  return $userInfo;
 +//}
 +</code>
  
  
auth/ntlm.1308402029.txt.gz · Last modified: 2011-06-18 15:00 by ach