Project

General

Profile

HowToAuthenticationFromMultipleFiles » History » Revision 5

Revision 4 (Anonymous, 2008-01-19 09:47) → Revision 5/6 (stbuehler, 2009-02-17 10:30)

h2. Authentication From Multiple Userfiles 

 



 If you use different userfile files for authenticating in different directories, you can attach each to the correct directory by using conditionals.   

 Let's say you have a /admin directory that authenticates with admin_users.txt file which is an htpasswd file. 
 You can set it up in the configuration file like this: 

 


 <pre> 
 

 $HTTP["url"] =~ "^/admin/" { 
   auth.backend = "htpasswd" 
   auth.backend.htpasswd.userfile = "/http/admin_users.txt" 
   auth.require = ("/admin" => ( 
      "method"    => "basic", 
      "realm"     => "admin", 
      "require" => "valid-user" 
   )) 
 } 
 </pre> 

 



 Now you need to setup directory /work/admin that authenticates with 
 work_users.txt. You can use this: 

 



 <pre> 
 

 $HTTP["url"] =~ "^/work/admin/" { 
   auth.backend = "htpasswd" 
   auth.backend.htpasswd.userfile = "/http/work_users.txt" 
   auth.require = ("/work/admin" => ( 
      "method"    => "basic", 
      "realm"     => "work_admin", 
      "require" => "valid-user" 
   )) 
 } 
 </pre>