function plugin_openid_action() { global $vars, $_openid_msg, $auth_api; // OpenID 関連プラグイン経由の認証がOKの場合のみ通過を許可 if (!isset($auth_api['openid']['use'])) { return ''; } if (!$auth_api['openid']['use']) { Utility::dieMessage($_openid_msg['msg_invalid']); } // LOGOUT if (isset($vars['logout'])) { $obj = new AuthOpenId(); $obj->unsetSession(); $page = empty($vars['page']) ? '' : $vars['page']; Utility::redirect(get_page_location_uri($page)); die; } // LOGIN if (!isset($vars['action'])) { return array('msg' => $_openid_msg['msg_title'], 'body' => plugin_openid_login_form()); } // AUTH if (!file_exists(PLUGIN_OPENID_STORE_PATH) && !mkdir(PLUGIN_OPENID_STORE_PATH)) { Utility::dieMessage(sprintf($_openid_msg['err_store_path'], PLUGIN_OPENID_STORE_PATH)); } ini_set('include_path', LIB_DIR . 'openid/'); require_once 'Auth/OpenID/Consumer.php'; require_once 'Auth/OpenID/FileStore.php'; require_once 'Auth/OpenID/SReg.php'; require_once 'Auth/OpenID/PAPE.php'; ini_restore('include_path'); global $pape_policy_uris; $pape_policy_uris = array(PAPE_AUTH_MULTI_FACTOR_PHYSICAL, PAPE_AUTH_MULTI_FACTOR, PAPE_AUTH_PHISHING_RESISTANT); $store = new Auth_OpenID_FileStore(PLUGIN_OPENID_STORE_PATH); $consumer = new Auth_OpenID_Consumer($store); switch ($vars['action']) { case 'verify': if (empty($vars['openid_url'])) { return array('msg' => $_openid_msg['msg_title'], 'body' => plugin_openid_login_form()); } return plugin_openid_verify($consumer); case 'finish_auth': return plugin_openid_finish_auth($consumer); } // Error. Utility::redirect(get_location_uri()); }