aboutsummaryrefslogtreecommitdiff
path: root/lib/oauth.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2014-08-21 17:20:04 +0200
committerChristian Weiske <cweiske@cweiske.de>2014-08-21 17:20:04 +0200
commit95103edfeeaf1bc750369ec35346fb53225af83b (patch)
tree8ba734a405ec7eadfdbcadb18bb8d27a496ca228 /lib/oauth.php
parent6a35b4262cccf97f932efbfe3cd9f546ead1be52 (diff)
downloadgrauphel-95103edfeeaf1bc750369ec35346fb53225af83b.tar.gz
grauphel-95103edfeeaf1bc750369ec35346fb53225af83b.zip
Support oauth on apache+fastcgi
Diffstat (limited to 'lib/oauth.php')
-rw-r--r--lib/oauth.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/oauth.php b/lib/oauth.php
index e2eb651..d6c72e8 100644
--- a/lib/oauth.php
+++ b/lib/oauth.php
@@ -140,7 +140,27 @@ class OAuth
*/
public static function getProvider()
{
- return new \OAuthProvider();
+ //$_SERVER['REDIRECT_HTTP_AUTHORIZATION'] = $_SERVER['HTTP_AUTHORIZATION'];
+ //unset($_SERVER['HTTP_AUTHORIZATION']);
+
+ $params = array();
+ if (!isset($_SERVER['HTTP_AUTHORIZATION'])
+ && isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])
+ ) {
+ //FastCgi puts the headers in REDIRECT_HTTP_AUTHORIZATION,
+ // but the oauth extension does not read that.
+ // we have to parse the parameters manually
+ $regex = "/(oauth_[a-z_-]*)=(?:\"([^\"]*)\"|([^,]*))/";
+ preg_match_all(
+ $regex, $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches
+ );
+
+ foreach ($matches[1] as $key => $paramName) {
+ $params[$paramName] = urldecode($matches[2][$key]);
+ }
+ }
+
+ return new \OAuthProvider($params);
}
}
?>