diff options
author | zotlabs <mike@macgirvin.com> | 2017-09-09 13:34:57 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-09-09 13:34:57 -0700 |
commit | e2e7bee3cca6f2ffc88aee9c94066e117e7a682b (patch) | |
tree | 5aec0c635bc6e3cb93c2794420e1c93bf52e2dd8 | |
parent | 84c86f01c853f87be93807b3e190f954aca2e6e6 (diff) | |
download | volse-hubzilla-e2e7bee3cca6f2ffc88aee9c94066e117e7a682b.tar.gz volse-hubzilla-e2e7bee3cca6f2ffc88aee9c94066e117e7a682b.tar.bz2 volse-hubzilla-e2e7bee3cca6f2ffc88aee9c94066e117e7a682b.zip |
owa cleanup
-rw-r--r-- | Zotlabs/Module/Magic.php | 13 | ||||
-rw-r--r-- | Zotlabs/Module/Owa.php | 18 | ||||
-rw-r--r-- | include/zid.php | 5 |
3 files changed, 10 insertions, 26 deletions
diff --git a/Zotlabs/Module/Magic.php b/Zotlabs/Module/Magic.php index 342c11eb9..d1550ec89 100644 --- a/Zotlabs/Module/Magic.php +++ b/Zotlabs/Module/Magic.php @@ -142,11 +142,8 @@ class Magic extends \Zotlabs\Web\Controller { $headers['X-Open-Web-Auth'] = random_string(); $headers = \Zotlabs\Web\HTTPSig::create_sig('',$headers,$channel['channel_prvkey'], 'acct:' . $channel['channel_address'] . '@' . \App::get_hostname(),false,true,'sha512'); - $x = z_fetch_url($basepath . '/owa',false,$redirects,[ 'headers' => $headers ]); - logger('owtfetch: ' . print_r($x,true)); - if($x['success']) { $j = json_decode($x['body'],true); if($j['success'] && $j['token']) { @@ -161,16 +158,6 @@ class Magic extends \Zotlabs\Web\Controller { $token = random_string(); -// $token_sig = base64url_encode(rsa_sign($token,$channel['channel_prvkey'])); -// $channel['token'] = $token; -// $channel['token_sig'] = $token_sig; - - - - - - - \Zotlabs\Zot\Verify::create('auth',$channel['channel_id'],$token,$x[0]['hubloc_url']); $target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode(channel_reddress($channel)) diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index 900ab9f85..4b0d855c5 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -15,8 +15,10 @@ namespace Zotlabs\Module; class Owa extends \Zotlabs\Web\Controller { function init() { - foreach([ 'REDIRECT_REMOTE_USER', 'HTTP_AUTHORIZATION' ] as $head) { + $ret = [ 'success' => false ]; + + foreach([ 'REDIRECT_REMOTE_USER', 'HTTP_AUTHORIZATION' ] as $head) { if(array_key_exists($head,$_SERVER) && substr(trim($_SERVER[$head]),0,9) === 'Signature') { if($head !== 'HTTP_AUTHORIZATION') { $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER[$head]; @@ -34,24 +36,18 @@ class Owa extends \Zotlabs\Web\Controller { ); if($r) { $hubloc = $r[0]; - $verified = \Zotlabs\Web\HTTPSig::verify('',$hubloc['xchan_pubkey']); - + $verified = \Zotlabs\Web\HTTPSig::verify('',$hubloc['xchan_pubkey']); if($verified && $verified['header_signed'] && $verified['header_valid']) { + $ret['success'] = true; $token = random_string(32); \Zotlabs\Zot\Verify::create('owt',0,$token,$r[0]['hubloc_addr']); - $x = json_encode([ 'success' => true, 'token' => $token ]); - header('Content-Type: application/x-zot+json'); - echo $x; - killme(); + $ret['token'] = $token; } } } } } } - $x = json_encode([ 'success' => false ]); - header('Content-Type: application/x-zot+json'); - echo $x; - killme(); + json_return_and_die($ret,'application/x-zot+json'); } } diff --git a/include/zid.php b/include/zid.php index 08d8f061b..ce9f70385 100644 --- a/include/zid.php +++ b/include/zid.php @@ -296,12 +296,13 @@ function owt_init($token) { $_SESSION['DNT'] = 1; } - $arr = array('xchan' => $hubloc, 'url' => \App::query_string, 'session' => $_SESSION); + $arr = array('xchan' => $hubloc, 'url' => \App::$query_string, 'session' => $_SESSION); call_hooks('magic_auth_success',$arr); \App::set_observer($hubloc); require_once('include/security.php'); \App::set_groups(init_groups_visitor($_SESSION['visitor_id'])); - info(sprintf( t('Welcome %s. Remote authentication successful.'),$hubloc['xchan_name'])); + if(! get_config('system','hide_owa_greeting')) + info(sprintf( t('OpenWebAuth: %1$s welcomes %2$s'),\App::get_hostname(), $hubloc['xchan_name'])); logger('OpenWebAuth: auth success from ' . $hubloc['xchan_addr']); |