aboutsummaryrefslogtreecommitdiffstats
path: root/include/security.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-07-14 19:24:15 -0700
committerredmatrix <git@macgirvin.com>2016-07-14 19:24:15 -0700
commite6c861480138ba871907ed6994d0fb840fd0e77f (patch)
tree7f6746c840df31943616a4cfa07f01ae2ee426c7 /include/security.php
parent05a9f2f0f58b9ca84e3a286a6126baf9455f947b (diff)
downloadvolse-hubzilla-e6c861480138ba871907ed6994d0fb840fd0e77f.tar.gz
volse-hubzilla-e6c861480138ba871907ed6994d0fb840fd0e77f.tar.bz2
volse-hubzilla-e6c861480138ba871907ed6994d0fb840fd0e77f.zip
first cut at zot access tokens
Diffstat (limited to 'include/security.php')
-rw-r--r--include/security.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/security.php b/include/security.php
index 212690d91..55e9d906f 100644
--- a/include/security.php
+++ b/include/security.php
@@ -82,6 +82,39 @@ function authenticate_success($user_record, $login_initial = false, $interactive
/* else just return */
}
+function atoken_login($atoken) {
+ if(! $atoken)
+ return false;
+
+ $xchan = atoken_xchan($atoken);
+
+ $_SESSION['authenticated'] = 1;
+ $_SESSION['visitor_id'] = $xchan['xchan_hash'];
+ $_SESSION['atoken'] = $atoken['atoken_id'];
+
+ \App::set_observer($xchan);
+
+ return [ 'atoken' => true ];
+}
+
+
+function atoken_xchan($atoken) {
+
+ return [
+ 'xchan_hash' => $atoken['atoken_uid'] . '.' . $atoken['atoken_name'],
+ 'xchan_network' => 'unknown',
+ 'xchan_hidden' => 1,
+ 'xchan_photo_mimetype' => 'image/jpeg',
+ 'xchan_photo_l' => get_default_profile_photo(300),
+ 'xchan_photo_m' => get_default_profile_photo(80),
+ 'xchan_photo_s' => get_default_profile_photo(48)
+
+ ];
+
+}
+
+
+
/**
* @brief Change to another channel with current logged-in account.
*