1<?php 2 3/** 4 * Provides generic SSO authentication 5 * @author Etienne MELEARD <etienne.meleard@renater.fr> 6 * @date 2018-09-19 7 */ 8 9use dokuwiki\Form\Form; 10 11/** 12 * Plugin 13 */ 14class action_plugin_genericsso extends DokuWiki_Action_Plugin { 15 /** 16 * Register listeners 17 * 18 * @param Doku_Event_Handler $controller 19 */ 20 public function register(Doku_Event_Handler $controller) { 21 $controller->register_hook('HTML_LOGINFORM_OUTPUT', 'BEFORE', $this, 'handle'); 22 } 23 24 /** 25 * Handle event 26 * 27 * @param Doku_Event $event 28 * @param mixed $param 29 */ 30 public function handle(Doku_Event $event, $param) { 31 global $lang; 32 global $conf; 33 global $ID; 34 35 if($conf['authtype'] !== 'genericsso') 36 return; 37 38 $form = new Form(['id' => 'dw__login']); 39 $form->setHiddenField('id', $ID); 40 $form->setHiddenField('do', 'login'); 41 $form->addButton('', $lang['btn_login'])->attr('type', 'submit'); 42 43 $event->data = $form; 44 } 45} 46