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 revision
Previous revision
Last revisionBoth sides next revision
auth:ntlm [2008-12-09 19:47] 70.103.232.219auth:ntlm [2016-01-20 08:31] 77.40.51.212
Line 4: Line 4:
 This page describes how to set up NTLM (i.e. Windows NT-based) authentication for DokuWiki running on Apache. As an added bonus, the second half of this page describes what you need to do to enable Firefox to "see" this configuration. This page describes how to set up NTLM (i.e. Windows NT-based) authentication for DokuWiki running on Apache. As an added bonus, the second half of this page describes what you need to do to enable Firefox to "see" this configuration.
  
-//Note: For obvious reasons, this document assumes a DokuWiki install on Windows (perhaps using [[http://www.easyphp.org|EasyPHP]] , [[http://www.dokuwiki.org/ntlm|XAMPP]] or [[http://bitnami.org/stack/dokuwiki|Bitnami DokuWiki Stack]])//+//Note: For obvious reasons, this document assumes a DokuWiki install on Windows (perhaps using [[http://www.easyphp.org|EasyPHP]] , [[http://www.apachefriends.org/en/xampp.html|XAMPP]] or [[http://bitnami.org/stack/dokuwiki|Bitnami DokuWiki Stack]])//
  
 ===== Setup NTLM authentication for Apache ===== ===== Setup NTLM authentication for Apache =====
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>
  
  

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