• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

PukiWiki


Commit MetaInfo

Revisãob5db2e96cba94b0f1fe1d7f88b08d0464bebd6ba (tree)
Hora2016-01-23 01:26:19
Autorumorigu <umorigu@gmai...>
Commiterumorigu

Mensagem de Log

BugTrack2/373 AUTH_TYPE_EXTERNAL - Use external sign-in mechanism

In pukiwiki.ini.php, you can define $auth_external_login_url URL.
It is a external sign in URL.

For example,


$auth_type = AUTH_TYPE_EXTERNAL;
$auth_external_login_url = './exlogin.php';

If you meet a private page that requires access permission,
a system redirect you to './exlogin.php' with 'url_after_login'
parameter.

In this case, 'exlogin.php' is your custom PHP script.
After you sign in your SSO system,
please redirect back to 'url_after_login' page.

Mudança Sumário

Diff

--- a/lib/auth.php
+++ b/lib/auth.php
@@ -182,6 +182,7 @@ function basic_auth($page, $auth_flag, $exit_flag, $auth_pages, $title_cannot)
182182 {
183183 global $auth_method_type, $auth_users, $_msg_auth, $auth_user, $auth_groups;
184184 global $auth_user_groups, $auth_type, $g_query_string;
185+ global $auth_external_login_url;
185186 // Checked by:
186187 $target_str = '';
187188 if ($auth_method_type == 'pagename') {
@@ -211,7 +212,14 @@ function basic_auth($page, $auth_flag, $exit_flag, $auth_pages, $title_cannot)
211212 } elseif (AUTH_TYPE_FORM === $auth_type) {
212213 $url_after_login = get_script_uri() . '?' . $g_query_string;
213214 $loginurl = get_script_uri() . '?plugin=loginform'
214- . '&page=' . rawurlencode($page)
215+ . '&page=' . pagename_urlencode($page)
216+ . '&url_after_login=' . rawurlencode($url_after_login);
217+ header('HTTP/1.0 302 Found');
218+ header('Location: ' . $loginurl);
219+ } elseif (AUTH_TYPE_EXTERNAL === $auth_type) {
220+ $url_after_login = get_script_uri() . '?' . $g_query_string;
221+ $loginurl = $auth_external_login_url . '?'
222+ . '&page=' . pagename_urlencode($page)
215223 . '&url_after_login=' . rawurlencode($url_after_login);
216224 header('HTTP/1.0 302 Found');
217225 header('Location: ' . $loginurl);
@@ -261,6 +269,7 @@ function ensure_valid_auth_user()
261269 return true; // no auth input
262270 }
263271 case AUTH_TYPE_FORM:
272+ case AUTH_TYPE_EXTERNAL:
264273 {
265274 session_start();
266275 // session_regenerate_id(true);
--- a/pukiwiki.ini.php
+++ b/pukiwiki.ini.php
@@ -235,8 +235,9 @@ $auth_groups = array(
235235
236236 /////////////////////////////////////////////////
237237 // Authentication type
238-// AUTH_TYPE_NONE, AUTH_TYPE_BASIC or AUTH_TYPE_EXTERNAL
239-// $auth_type = AUTH_TYPE_BASIC;
238+// AUTH_TYPE_FORM, AUTH_TYPE_BASIC or AUTH_TYPE_EXTERNAL
239+// $auth_type = AUTH_TYPE_FORM;
240+// $auth_external_login_url = './exlogin.php';
240241
241242 /////////////////////////////////////////////////
242243 // Authentication method