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 revisionPrevious revision
Next revisionBoth sides next revision
auth:ntlm [2011-06-18 15:00] – corrected link achauth:ntlm [2012-02-17 10:56] 87.162.133.94
Line 201: Line 201:
   * [[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>
 +    /**
 +     * 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>
 +//function getUserData($user) {
 +//  global $conf;
 +//  $userInfo['name'] = niceNtlmUserName($user);
 +//  $userInfo['mail'] = $userInfo['name'].'@solvay.com';
 +//  $userInfo['grps'] = array($conf['defaultgroup']);
 +//  return $userInfo;
 +//}
 +</code>
  
  

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki