httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boyle Owen" <Owen.Bo...@swx.com>
Subject RE: [users@httpd] Basic Authorization:Can I protect two directories simultaneously?
Date Mon, 02 Sep 2002 13:11:05 GMT
So you have two parallel Locations and you want to be able to access the two after logging
in to one. This is not possible since the browser uses the URL to distinguish different "realms"
(you browser caches the user/pass and issues it with every request inside the location which
called for it. For two parallel realms, it caches two distinct user/pass pairs).

The only workaround I can think of is to restructure your site slightly: create an intermediate
directory (e.g. called "x") and put cocoon and myproject inside it, then protect "x", but
unprotect myproject and cocoon, e.g.

<Location /x>
  AuthType Basic
  AuthName Login
  Require valid-user
  AuthUserFile "C:/Programme/Apache/Apache/conf/mod_auth.users"
</Location>

Now your URLs look like http://servername/x/cocoon and http://servername/x/myproject. Now
you only have one realm and authentication will be triggered for either sub-directory. NOte
that you don't actually have to have any content in "x", apart from the two sub-directories,
since you just jump directly into the subdirs..

Rgds,

Owen Boyle

P.S. >Bao: although it is a good idea to check the context for directives, watch out for
<Location>, <Files> etc.. these can actually take the same directives as <Directory>.
Check the sections.html tutorial in the httpd docs for details.

>-----Original Message-----
>From: Skladovs, Victor [mailto:Skladov@his.de]
>Sent: Montag, 2. September 2002 12:08
>To: users@httpd.apache.org
>Subject: AW: [users@httpd] Basic Authorization:Can I protect two
>directories simultaneously?
>
>
>Hallo DW!
>
>It doesn't work by me with <Director> tag at all.
>In my httpd.conf I have:
><Location /myproject>
>AuthType Basic
>AuthName Login
>Require valid-user
>AuthUserFile "C:/Programme/Apache/Apache/conf/mod_auth.users"
>
></Location>
><Location /cocoon>
>AuthType Basic
>AuthName Login
>Require valid-user
>AuthUserFile "C:/Programme/Apache/Apache/conf/mod_auth.users"
></Location>
>
>/myproject and /cocoon are NOT the Apache directories, but Tomcat
>webapps. Apache knows about them as I use mod_jk.
>I've got at the moment two authorization dialogs: first, when I call my
>servlets, that lies in /myproject, the second -  when I want to work
>with /cocoon. Actually, I'd not like to have the dialog two times and
>the idea was whether it is possible to "unite" these two location tags
>in one, so to speak.
>
>Any ideas?
>
>Viktor
>
>-----Ursprungliche Nachricht-----
>Von: Dirk-Willem van Gulik [mailto:dirkx@webweaving.org]
>Gesendet: Montag, 2. September 2002 11:34
>An: users@httpd.apache.org
>Betreff: Re: [users@httpd] Basic Authorization:Can I protect two
>directories simultaneously?
>
>
>
>
>On Mon, 2 Sep 2002, Skladovs, Victor wrote:
>
>> The question to all is: can I protect two directories (in httpd.conf)
>> simultaneously?
>> I mean: if I log in for directory /dir1, it will valid also 
>for /dir2,
>I
>> will not be promted to authentificate myself for /dir2 anymore.
>
>Actually you will find that the server will ask for a password for dir2
>-
>but that your browser will, behind the scenes, give your password along
>with the request for /dir2.
>
>Generally a browser fill re-use a password entered earlier if a) the
>site
>is still the same and b) the Realm string (AuthName) is the still same.
>
>Most (but not all - MS is most notably broken a bit) browsers will not
>prompt you for a passwd for /second if you gave it for /first; but will
>ask it for /third.
>
>	<Directory ...../first>
>		AuthType basic
>		AuthName Foo
>		Auth...
>		require valid-user
>	</Directory>
>	<Directory ...../second>
>		AuthType basic
>		AuthName Foo
>		Auth...
>		require valid-user
>	</Directory>
>	<Directory ..../third>
>		AuthType basic
>		AuthName Bar
>		Auth...
>		require valid-user
>	</Directory>
>
>Dw
>
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP Server
>Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP 
>Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message