[pmwiki-users] Pubcookie & pmwiki

Derek Yeung dky at utcc.utoronto.ca
Tue Feb 21 14:10:11 CST 2006


Hi Patrick, et al,

I've been poking at the PmWiki source code for a bit in trying to get 
PubCookie to work with PmWiki.

Here's some of my discoveries...  Any suggestions are appreciated.
My config.php has include_once=('scripts/httpauth.php');

I've placed some markers to log what's happening in some of the PmWiki php 
files.  I've put an .htaccess file that will redirect the user to the 
pubcookie server, and once authentication is successful, the pubcookie 
server will send a cookie to the requesting server and the PmWiki page 
should show.  At the moment it kinda works.  I see an incomplete page, but 
content is available.  I'm not sure, but from what the page looks like, it 
might have something to do with http versus https URL's (i.e. the top left 
logo.gif is in http?) -- I'm tipped on this because of the missing logo 
image.  I'm unable to edit.  Which might be a good thing.

The behaviour is that everytime a link is clicked, i'm redirected back to 
the pubcookie server, then back to the wiki site.  I looked at the 
UserAuth code, and it seems to have some caching work there.  Is caching 
necessary for this to work?

The output to what the pubcookie server is forwarding is here:

     [UNIQUE_ID] => some_pubcookie_unique_id
     [REMOTE_REALM] =>
     [HTTPS] => on
     [HTTP_ACCEPT] => */*
     [HTTP_ACCEPT_LANGUAGE] => en
     [HTTP_ACCEPT_ENCODING] => gzip, deflate
     [HTTP_COOKIE] => pubcookie_pre_s=XXXXXX; pubcookie_g=XXX
     [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en)
     [HTTP_CONNECTION] => close
     [HTTP_HOST] => host.utoronto.ca
     [PATH] => /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
     [SERVER_SIGNATURE] => Apache/2.0.46 (Red Hat) Server at host.ns.utoronto.ca Port 443

     [SERVER_NAME] => host.utoronto.ca
     [SERVER_ADDR] => 192.168.0.1
     [SERVER_PORT] => 443
     [REMOTE_ADDR] => 192.168.0.2
     [DOCUMENT_ROOT] => /pmwiki
     [SERVER_ADMIN] => dky at utcc.utoronto.ca
     [SCRIPT_FILENAME] => /pmwiki/index2.php
     [REMOTE_PORT] => 64078
     [REMOTE_USER] => userid
     [AUTH_TYPE] => authUT
     [GATEWAY_INTERFACE] => CGI/1.1
     [SERVER_PROTOCOL] => HTTP/1.1
     [REQUEST_METHOD] => GET
     [QUERY_STRING] =>
     [REQUEST_URI] => /pmwiki/index2.php
     [SCRIPT_NAME] => /pmwiki/index2.php
     [PHP_SELF] => /pmwiki/index2.php
     [PATH_TRANSLATED] => /pmwiki/index2.php


Using httpauth.php, it seems that PmWiki knows the $AuthId, however, no 
$AuthFunction is defined.

     $AuthId='userid from pubcookie server'
     $AuthFunction=

What $AuthFunction should PmWiki be using?
   (maybe a new one, i.e. $AuthFunction='pubcookie'?)

Is there enough inside httpauth.php to make pubcookie work?

I looked at UserAuth/HtPasswd.php.  I quite like how it works!  I was 
wondering if it's possible to use HtPasswd.php in some way to authorize 
who has access (perhaps with read/edit/admin rights?) to the wiki?
i.e.
   if user_id exists in local/.htpasswd,
      then allow access.
   else
     disallow();


Once this works, i'd be happy to help document it.  :-)

Many sincere thanks,
/dky

On Tue, 7 Feb 2006, Patrick R. Michaud wrote:

> On Mon, Feb 06, 2006 at 11:51:35PM -0500, Derek Yeung wrote:
>>
>> Has anyone been successful in integrating pubcookie and pmwiki?  If so,
>> could you kindly share your success and how you managed to do it?
>
> Wow, I hadn't even heard of pubcookie before your message.  It
> looks quite promising.
>
> Since pubcookie just uses the REMOTE_USER variable to communicate
> authentication information to applications, it seems like one ought
> to be able to just do
>
>    include_once('scripts/httpauth.php');
>
> and have it successfully identify people who have authenticated
> with pubcookie.  We might need to do a little tweaking to handle
> anonymous access, but other than that it ought to work.
>
> I'll be glad to help find and document the exact configuration that
> works, but essentially most of what is needed appears to be already
> built into PmWiki.  :-)
>
> Pm
>
>




More information about the pmwiki-users mailing list