public function OAuthStoreSQL::getSecretsForVerify in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.2 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::getSecretsForVerify()
- 7.3 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::getSecretsForVerify()
- 7.4 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::getSecretsForVerify()
- 7.5 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::getSecretsForVerify()
- 7.6 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::getSecretsForVerify()
* Find stored credentials for the consumer key and token. Used by an OAuth server * when verifying an OAuth request. * *
Parameters
string consumer_key: * @param string token * @param string token_type false, 'request' or 'access' * @exception OAuthException2 when no secrets where found * @return array assoc (consumer_secret, token_secret, osr_id, ost_id, user_id)
Overrides OAuthStoreAbstract::getSecretsForVerify
File
- lib/
oauth-php/ library/ store/ OAuthStoreSQL.php, line 110
Class
Code
public function getSecretsForVerify($consumer_key, $token, $token_type = 'access') {
if ($token_type === false) {
$rs = $this
->query_row_assoc('
SELECT osr_id,
osr_consumer_key as consumer_key,
osr_consumer_secret as consumer_secret
FROM oauth_server_registry
WHERE osr_consumer_key = \'%s\'
AND osr_enabled = 1
', $consumer_key);
if ($rs) {
$rs['token'] = false;
$rs['token_secret'] = false;
$rs['user_id'] = false;
$rs['ost_id'] = false;
}
}
else {
$rs = $this
->query_row_assoc('
SELECT osr_id,
ost_id,
ost_usa_id_ref as user_id,
osr_consumer_key as consumer_key,
osr_consumer_secret as consumer_secret,
ost_token as token,
ost_token_secret as token_secret
FROM oauth_server_registry
JOIN oauth_server_token
ON ost_osr_id_ref = osr_id
WHERE ost_token_type = \'%s\'
AND osr_consumer_key = \'%s\'
AND ost_token = \'%s\'
AND osr_enabled = 1
AND ost_token_ttl >= NOW()
', $token_type, $consumer_key, $token);
}
if (empty($rs)) {
throw new OAuthException2('The consumer_key "' . $consumer_key . '" token "' . $token . '" combination does not exist or is not enabled.');
}
return $rs;
}