aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-05-23 22:29:27 -0700
committerfriendica <info@friendica.com>2013-05-23 22:29:27 -0700
commit87e7deacf92811430ed113c66db91a3f8f4e476e (patch)
tree77cf1c6d838760598007b2ec7d877eef19b4e06e
parent5e83c58a95b0d38eee295476f0d7bb04fb6b60da (diff)
downloadvolse-hubzilla-87e7deacf92811430ed113c66db91a3f8f4e476e.tar.gz
volse-hubzilla-87e7deacf92811430ed113c66db91a3f8f4e476e.tar.bz2
volse-hubzilla-87e7deacf92811430ed113c66db91a3f8f4e476e.zip
use http_authorization header with nginx
-rw-r--r--include/api.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/api.php b/include/api.php
index 926b8510a..e6140b120 100644
--- a/include/api.php
+++ b/include/api.php
@@ -96,6 +96,16 @@ require_once('include/security.php');
}
}
+ if(x($_SERVER,'HTTP_AUTHORIZATION')) {
+ $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"],6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
+ }
+ }
+
+
if (!isset($_SERVER['PHP_AUTH_USER'])) {
logger('API_login: ' . print_r($_SERVER,true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Red"');