[dokuwiki] OAuth plugin & auth.php patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello dokuwiki-devs,

I ventured out to write an http://oauth.net/ plugin for dokuwiki: A user
authorizes an oAuth-token[..], which can later be used by a consumer to
perform requests on behalf of the user.

see http://mir.dnsalias.com/wiki/dokuoauth for details, source and examples.

In it's current state it implements an OAuth service-provider, the oAuth
plugin authenticates HTTP-GET, -POST and XML-RPC(!) requests to dokuwiki
according to oAuth Core 1.0 spec against a dokuwiki auth-backend. What's
missing is a nicer user/admin interface and integration with dokuwiki.
If anyone wants to join in, I'd like some help..

To hook into dokuwiki authentication on a per request basis a new
Doku_Event 'ACTION_ON_AUTH' has been introduced to ''inc/auth.php''.

I pragmatically helped myself with a small patch, but would appreciate
information, if the same can be achieved without modifying dokuwiki or
if the attached diff can be merged into dokuwiki-devel.

Implementing an oAuth Consumer (sign outgoing requests - eg. {{rss>}}
extern-includes or picture-aggregation,..) seems to be limited to
specific plugins.  To implement this properly, dokuwiki would need to
add a dedicated function for outgoing HTTP requests that can be hooked
into. What do you think? Does that seem to be a reasonable
feature-request for later dokuwiki versions?

cheers,
robin

- --- a/inc/auth.php
+++ b/inc/auth.php
@@ -72,7 +72,13 @@
         // external trust mechanism in place
         $auth->trustExternal($_REQUEST['u'],$_REQUEST['p'],$_REQUEST['r']);
       }else{
- -        auth_login($_REQUEST['u'],$_REQUEST['p'],$_REQUEST['r']);
+        $evt = new Doku_Event('ACTION_ON_AUTH',$ACT);
+        $evt->advise_before();
+        if(empty($_SERVER['REMOTE_USER'])) {
+            auth_login($_REQUEST['u'],$_REQUEST['p'],$_REQUEST['r']);
+        }
+        $evt->advise_after();
+        unset($evt);
       }
     }

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkj+T8IACgkQeVUk8U+VK0KW1ACfctUviSlhM9c31L452Bt/p37G
emUAnRODqxAAddGYmyIooG4XQhP0bRD8
=L6Ok
-----END PGP SIGNATURE-----
-- 
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: