private function LingotekOAuthRequest::parseHeaders in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.4 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::parseHeaders()
- 7.5 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::parseHeaders()
- 7.6 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::parseHeaders()
* Parse the oauth parameters from the request headers * Looks for something like: * Authorization: OAuth realm="http://photos.example.net/authorize", oauth_consumer_key="dpf43f3p2l4k3l03", oauth_token="nnch734d00sl2jdk", oauth_signature_method="HMAC-SHA1", oauth_signature="tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D", oauth_timestamp="1191242096", oauth_nonce="kllo9940pd9333jh", oauth_version="1.0"
1 call to LingotekOAuthRequest::parseHeaders()
- LingotekOAuthRequest::__construct in lib/
oauth-php/ library/ LingotekOAuthRequest.php - * Construct from the current request. Useful for checking the signature of a request. * When not supplied with any parameters this will use the current request. * *
File
- lib/
oauth-php/ library/ LingotekOAuthRequest.php, line 593
Class
- LingotekOAuthRequest
- Object to parse an incoming OAuth request or prepare an outgoing OAuth request
Code
private function parseHeaders() {
/*
$this->headers['Authorization'] = 'OAuth realm="http://photos.example.net/authorize",
oauth_consumer_key="dpf43f3p2l4k3l03",
oauth_token="nnch734d00sl2jdk",
oauth_signature_method="HMAC-SHA1",
oauth_signature="tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D",
oauth_timestamp="1191242096",
oauth_nonce="kllo9940pd9333jh",
oauth_version="1.0"';
*/
if (isset($this->headers['Authorization'])) {
$auth = trim($this->headers['Authorization']);
if (strncasecmp($auth, 'OAuth', 4) == 0) {
$vs = explode(',', substr($auth, 6));
foreach ($vs as $v) {
if (strpos($v, '=')) {
$v = trim($v);
list($name, $value) = explode('=', $v, 2);
if (!empty($value) && $value[0] == '"' && substr($value, -1) == '"') {
$value = substr(substr($value, 1), 0, -1);
}
if (strcasecmp($name, 'realm') == 0) {
$this->realm = $value;
}
else {
$this->param[$name] = $value;
}
}
}
}
}
}