encrypt the owa token
This commit is contained in:
parent
b62dee4c90
commit
1ef558d7e6
@ -146,10 +146,17 @@ class Magic extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
if($x['success']) {
|
if($x['success']) {
|
||||||
$j = json_decode($x['body'],true);
|
$j = json_decode($x['body'],true);
|
||||||
if($j['success'] && $j['token']) {
|
if($j['success']) {
|
||||||
$x = strpbrk($dest,'?&');
|
$token = '';
|
||||||
$args = (($x) ? '&owt=' . $j['token'] : '?f=&owt=' . $j['token']) . (($delegate) ? '&delegate=1' : '');
|
if($j['encrypted_token']) {
|
||||||
|
openssl_private_decrypt(base64url_decode($j['encrypted_token']),$token,$channel['channel_prvkey']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$token = $j['token'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$x = strpbrk($dest,'?&');
|
||||||
|
$args = (($x) ? '&owt=' . $token : '?f=&owt=' . $token) . (($delegate) ? '&delegate=1' : '');
|
||||||
goaway($dest . $args);
|
goaway($dest . $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,9 @@ class Owa extends \Zotlabs\Web\Controller {
|
|||||||
$ret['success'] = true;
|
$ret['success'] = true;
|
||||||
$token = random_string(32);
|
$token = random_string(32);
|
||||||
\Zotlabs\Zot\Verify::create('owt',0,$token,$r[0]['hubloc_addr']);
|
\Zotlabs\Zot\Verify::create('owt',0,$token,$r[0]['hubloc_addr']);
|
||||||
$ret['token'] = $token;
|
$result = '';
|
||||||
|
openssl_public_encrypt($token,$result,$hubloc['xchan_pubkey']);
|
||||||
|
$ret['encrypted_token'] = base64url_encode($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user