aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Identity/OAuth2Storage.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-08-14 13:04:37 +0200
committerMario Vavti <mario@mariovavti.com>2018-08-14 13:04:37 +0200
commit10c5b46e3bb4cfa76cbe7158f5eba54809cd0d79 (patch)
treedfa20f7e1010f76a9f4b6b7b395cdb57744725e3 /Zotlabs/Identity/OAuth2Storage.php
parentb503ef8761e3efd04bf1d1498109344d9ecdb738 (diff)
parentf15c1c4e54a49d1e76747ca5e3034ca2cef909aa (diff)
downloadvolse-hubzilla-10c5b46e3bb4cfa76cbe7158f5eba54809cd0d79.tar.gz
volse-hubzilla-10c5b46e3bb4cfa76cbe7158f5eba54809cd0d79.tar.bz2
volse-hubzilla-10c5b46e3bb4cfa76cbe7158f5eba54809cd0d79.zip
Merge remote-tracking branch 'mike/master' into dev
Diffstat (limited to 'Zotlabs/Identity/OAuth2Storage.php')
-rw-r--r--Zotlabs/Identity/OAuth2Storage.php35
1 files changed, 23 insertions, 12 deletions
diff --git a/Zotlabs/Identity/OAuth2Storage.php b/Zotlabs/Identity/OAuth2Storage.php
index a50b21a70..bbf61cf2b 100644
--- a/Zotlabs/Identity/OAuth2Storage.php
+++ b/Zotlabs/Identity/OAuth2Storage.php
@@ -55,15 +55,22 @@ class OAuth2Storage extends \OAuth2\Storage\Pdo {
return false;
}
+ $a = q("select * from account where account_id = %d",
+ intval($x['channel_account_id'])
+ );
+
+ $n = explode(' ', $x['channel_name']);
+
return( [
- 'webbie' => $x['channel_address'].'@'.\App::get_hostname(),
- 'zothash' => $x['channel_hash'],
- 'username' => $x['channel_address'],
- 'user_id' => $x['channel_id'],
- 'name' => $x['channel_name'],
- 'firstName' => $x['channel_name'],
- 'lastName' => '',
- 'password' => 'NotARealPassword'
+ 'webfinger' => channel_reddress($x),
+ 'portable_id' => $x['channel_hash'],
+ 'email' => $a['account_email'],
+ 'username' => $x['channel_address'],
+ 'user_id' => $x['channel_id'],
+ 'name' => $x['channel_name'],
+ 'firstName' => ((count($n) > 1) ? $n[1] : $n[0]),
+ 'lastName' => ((count($n) > 2) ? $n[count($n) - 1] : ''),
+ 'picture' => $x['xchan_photo_l']
] );
}
@@ -91,12 +98,16 @@ class OAuth2Storage extends \OAuth2\Storage\Pdo {
$userClaims = Array();
$claims = explode (' ', trim($claims));
- $validclaims = Array ("name","preferred_username","zothash");
+ $validclaims = Array ("name","preferred_username","webfinger","portable_id","email","picture","firstName","lastName");
$claimsmap = Array (
- "zotwebbie" => 'webbie',
- "zothash" => 'zothash',
+ "webfinger" => 'webfinger',
+ "portable_id" => 'portable_id',
"name" => 'name',
- "preferred_username" => "username"
+ "email" => 'email',
+ "preferred_username" => 'username',
+ "picture" => 'picture',
+ "given_name" => 'firstName',
+ "family_name" => 'lastName'
);
$userinfo = $this->getUser($user_id);
foreach ($validclaims as $validclaim) {