Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-07-31 13:45:22

Skeely
New Member
From: Edinburgh
Registered: 2004-03-02
Posts: 4
Website

Protect a section with HTTP authentication?

A client is selling a web service using PayPal’s subscription password management script, which gives subscribers access to a directory through basic HTTP authentication. The PayPal perl script automatically updates an .htpasswd file, removing access when a subscriber stops paying.

All is working well, but we would also like to allow access to articles in a Textpattern section reserved for subscribers. So, we really need to have Textpattern apply HTTP authentication to one site section, using a given .htaccess file. Any ideas how I should go about this?

Offline

#2 2006-07-31 16:26:03

alexandra
Member
From: Cologne, Germany
Registered: 2004-04-02
Posts: 1,370

Re: Protect a section with HTTP authentication?

Did you already do a forum search ?
There is a plugin called ign_passwordprotect… that might help?

Offline

#3 2006-07-31 16:37:56

Skeely
New Member
From: Edinburgh
Registered: 2004-03-02
Posts: 4
Website

Re: Protect a section with HTTP authentication?

Yes, I spent a long time searching the forum, although it’s perfectly possible that I have missed the blindingly obvious somewhere.

As far as I can see, ign_passwordprotect uses the textpattern database to restrict access. I want to use an already existing Apache password file (.htpasswd).

Offline

#4 2006-07-31 16:52:56

hcgtv
Archived Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Protect a section with HTTP authentication?

Honestly, I don’t know how that can be done since a section is not really a physical directory.

But I’d like to hear if there is a solution because I too was contemplating the same thing.

Offline

#5 2006-07-31 17:05:17

Esteban_Panzera
New Member
Registered: 2006-07-31
Posts: 4

Re: Protect a section with HTTP authentication?

I am looking the same thing, and I already spent some time searching the forums, didn’t find anything though

Offline

#6 2006-07-31 17:38:23

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Protect a section with HTTP authentication?

Suppose your website is at http://example.com and TXP is installed in the root directory and you want to protect the section called ‘protected’ (http://example.com/protected), you could try this:

  1. Physically create that directory ‘protected’
  2. Within that directory ‘protected’, create the following .htaccess file:
    <notextile><pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteRule ^(.*) ../index.php
    &lt;/IfModule&gt;

AuthType Basic
AuthUserFile /path/on/server/to/.htpasswd
AuthName “Only for registered users”
require valid-user</code></pre></notextile>

Offline

#7 2006-08-01 10:43:46

Skeely
New Member
From: Edinburgh
Registered: 2004-03-02
Posts: 4
Website

Re: Protect a section with HTTP authentication?

Ruud, that works for me. Nice and simple too (once you know how, of course). Many thanks.

Offline

#8 2006-08-01 12:53:13

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: Protect a section with HTTP authentication?

ruud,
care to place this example in the “examples” forum. Its a good one :)


Offline

#9 2006-08-01 15:09:19

hcgtv
Archived Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Protect a section with HTTP authentication?

Thanks ruud, the creating of the directory was the key to it.

Offline

Board footer

Powered by FluxBB