DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:loginredirect

login redirector Plugin

Compatible with DokuWiki

lemming, anteater, rincewind, angua, adora belle

plugin Redirect the login button to another URL

Last updated on
2013-02-14
Provides
Action
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with authentication, redirect

This plugin redirects the DokuWiki login button to another URL. It is most useful when combined with an external authentication method and it can direct the user to the common login page used by that method.

Notes

Acknowledgments

Configuration

setting default value description
url empty string* URL of the external login page

If the url setting is empty, no redirection occurs and the normal DokuWiki login page will be shown.

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Revision History

  • 2006-12-22 — (darcs version only) Add ability to supply return URL
  • 2006-10-14 — Released.

To Do

  • add register redirect functionality, see discussion.

Bugs

See the issue tracker

Discussion


This plugin is (as far as I can see) incomplete. Every such third party authorization (Single Sign on) scheme relies on setting a cookie which can then be validated and used for authenticating the user. There should be a custom authentication class which checks the received signon cookie, validates the hash, sets the user, password, groups field (at the minimum) so that things like ACL could be implemented. Similarly, for logging a user out also needs to be implemented here. I have just finished writing custom authentication class and will clean it up and post it here for others…

Amit Chakradeo

Amit, your point is valid - this plugin requires a custom authentication mechanism to be of use. However, that is not the point of the plugin. If you are using an external login page, that page is most likely to set its own parameters for authentication and so each could well require its own authentication class. Also plugins by themselves can not influence authentication. There are no events surrounding authentication and I doubt any will be implemented. The plugin fills a gap whereby a “trust external” auth mechanism was unable to access the trusted external login page. — Christopher Smith 2006-11-03 20:44

It would be helpful to be able to append a return ID to the URL. If someone clicks the login button on a page buried:within:several:namespaces: it may be hard to navigate back to the page they wanted to edit.
I recommend adding configuration settings append_redir (onoff) and append_redir_key (string) so that $url would have ?key=value where value is either the ID (normalized to match current setting regarding url rewrites, etc) or a full URI. — Matt Ezell 2006-12-22 02:16

Hi Matt. Good idea and pretty straight forward to implement. I don't think there is any need for the append_redir setting. If the redir_key is present append it along with return url. If its not present, don't append anything. Does the value need to be encoded? — Christopher Smith 2006-12-22 18:34
I have implemented it for my custom login method, but I'm sending an ID and then redirecting to ../$_GET['ID']. I'm still too new to DW to know the best way to construct a URL based on the current page (because there are several different ways it may be constructed). I suppose you could just use the current URI and do a s/&+do=login//
You probably would need to run it through urlencode() but some testing would be necessary. Thanks!
Matt Ezell 2006-12-23 02:08

I would like a register redirector behaviour instead. I'm using the PunBB authentication. I prefer login to use the ordinary DokuWiki form since you get back to the same page after login, but I'd prefer the external register page (i.e. that of PunBB).

To turn this plugin into a register redirector plugin, just replace login with register, right? (Yes it is, I tried it!)

Viktor Söderqvist 2007-04-05 18:57

But it would be much better to add register redirect functionality to this same plugin. To do so, apply these changes:

In the end of function handle_loginredirect, add

      else if ($event->data == 'register') {
        $url = $this->getConf('url_register');
        if (empty($url)) return;
 
        header("Location: $url");
        exit();
      }

to settings/default.php add

$conf['url_register'] = '';               // location for register redirects

and to settings/metadata.php add

$meta['url_register'] = array('string');   // location for register redirects

Viktor Söderqvist 2007-04-05 20:52

To implement redirect, very simple change is needed, instead of:

      header("Location: $url");
     

do:

      $request_uri_no_querystring = preg_replace('/\?.*?$/', '', $_SERVER['REQUEST_URI']);
      header("Location: ". str_replace("%URL%", "https://" . $_SERVER['HTTP_HOST'] . $request_uri_no_querystring, $url));

And use %URL% for substitution when specifying redirect url, for example: blabla?next=%URL%

Domen Kožar

plugin/loginredirect.txt · Last modified: 2015-09-13 19:09 by Aleksandr