From d66d8ff524203ccc0fae894b483178b2f706b711 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 5 Dec 2013 15:40:50 -0800 Subject: mod_authtest --- magic-auth diagnostic for those that are too freaking important to read logs or code and expect others to be able to debug complex authentication transactions with no information beyond "it didn't work". This will provide a transaction report including both sides of the exchange that you can paste into a bug report and that a developer can actually figure out where in the transaction that things went wrong and maybe even be able to then figure out why. --- mod/authtest.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 mod/authtest.php (limited to 'mod/authtest.php') diff --git a/mod/authtest.php b/mod/authtest.php new file mode 100644 index 000000000..ec32fe171 --- /dev/null +++ b/mod/authtest.php @@ -0,0 +1,43 @@ +Magic-Auth Diagnostic'; + + if(! local_user()) { + notice( t('Permission denied.') . EOL); + return $o; + } + + $o .= '
'; + $o .= 'Target URL: '; + $o .= '
'; + + $o .= '

'; + + if(x($_GET,'dest')) { + $_REQUEST['test'] = 1; + $x = magic_init($a); + $o .= 'Local Setup returns: ' . print_r($x,true); + + + + if($x['url']) { + $z = z_fetch_url($x['url'] . '&test=1'); + if($z['success']) { + $j = json_decode($z['body'],true); + $o .= 'Remote site responded: ' . print_r($j,true); + } + else { + $o .= 'fetch url failure.' . print_r($z,true); + } + } + } + + return str_replace("\n",'
',$o); +} -- cgit v1.2.3 From 38577cf26cc241245731f786704ac773bfc52952 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 5 Dec 2013 18:17:16 -0800 Subject: issue #225 --- mod/authtest.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mod/authtest.php') diff --git a/mod/authtest.php b/mod/authtest.php index ec32fe171..2c8d7b4b4 100644 --- a/mod/authtest.php +++ b/mod/authtest.php @@ -31,6 +31,8 @@ function authtest_content(&$a) { $z = z_fetch_url($x['url'] . '&test=1'); if($z['success']) { $j = json_decode($z['body'],true); + if(! $j) + $o .= 'json_decode failure from remote site. ' . print_r($z['body'],true); $o .= 'Remote site responded: ' . print_r($j,true); } else { -- cgit v1.2.3 From 44ead61339745b975d4cff60894afb18b83fa55f Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 17 Dec 2013 16:35:22 -0800 Subject: authtest: do a better job of success/failure indication --- mod/authtest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'mod/authtest.php') diff --git a/mod/authtest.php b/mod/authtest.php index 2c8d7b4b4..7747ea504 100644 --- a/mod/authtest.php +++ b/mod/authtest.php @@ -6,7 +6,7 @@ require_once('mod/magic.php'); function authtest_content(&$a) { - + $auth_success = false; $o .= '

Magic-Auth Diagnostic

'; if(! local_user()) { @@ -34,11 +34,16 @@ function authtest_content(&$a) { if(! $j) $o .= 'json_decode failure from remote site. ' . print_r($z['body'],true); $o .= 'Remote site responded: ' . print_r($j,true); + if(strpos($j,'Authentication Success')) + $auth_success = true; } else { $o .= 'fetch url failure.' . print_r($z,true); } } + + if(! $auth_success) + $o .= 'Authentication Failed!' . EOL; } return str_replace("\n",'
',$o); -- cgit v1.2.3