1<?php
2/**
3 * DokuWiki envvars authentication plugin
4 * https://www.dokuwiki.org/plugin:authenvvars
5 *
6 * This is authenvvars action plugin which
7 * a.) skips the 'login' action as it does not make sense with HTTP
8 *     authentication.
9 *
10 * @license GPL 3 http://www.gnu.org/licenses/gpl-3.0.html
11 * @author Christian Hoffmann <christian@lehrer-hoffmann.de>
12 */
13
14// must be run within Dokuwiki
15if(!defined('DOKU_INC')) die();
16
17class action_plugin_authenvvars extends DokuWiki_Action_Plugin {
18
19  function register(Doku_Event_Handler $controller){
20    $controller->register_hook('ACTION_ACT_PREPROCESS', 'AFTER', $this, 'skip_login_action', NULL);
21  }
22
23  /**
24   * Event handler to skip the 'login' action
25   */
26  function skip_login_action(&$event, $param) {
27    /* Some actions handled in inc/actions.php:act_dispatch() result in $ACT
28       being modified to 'login', eg. 'register'. */
29    if($event->data == 'login') {
30        /* With HTTP authentication, there is no sense in showing a login form,
31           so we directly redirect to a 'show' action instead. By using
32           act_redirect() instead of modifying $event->data, we make sure
33           DokuWiki's entire auth logic can work, which is eg. required so that
34           after a user's registration he gets logged in automatically. */
35        act_redirect($ID, 'show');
36    }
37  }
38}
39