You are here

public function OAuthStoreOracle::getSecretsForVerify in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getSecretsForVerify()
  2. 7.2 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getSecretsForVerify()
  3. 7.3 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getSecretsForVerify()
  4. 7.5 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getSecretsForVerify()
  5. 7.6 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::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/OAuthStoreOracle.php, line 84

Class

OAuthStoreOracle

Code

public function getSecretsForVerify($consumer_key, $token, $token_type = 'access') {
  $sql = "BEGIN SP_GET_SECRETS_FOR_VERIFY(:P_CONSUMER_KEY, :P_TOKEN, :P_TOKEN_TYPE, :P_ROWS, :P_RESULT); END;";

  // parse sql
  $stmt = oci_parse($this->conn, $sql) or die('Can not parse query');

  // Bind In and Out Variables
  oci_bind_by_name($stmt, ':P_CONSUMER_KEY', $consumer_key, 255);
  oci_bind_by_name($stmt, ':P_TOKEN', $token, 255);
  oci_bind_by_name($stmt, ':P_TOKEN_TYPE', $token_type, 255);
  oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

  //Bind the ref cursor
  $p_row = oci_new_cursor($this->conn);
  oci_bind_by_name($stmt, ':P_ROWS', $p_row, -1, OCI_B_CURSOR);

  //Execute the statement
  oci_execute($stmt);

  // treat the ref cursor as a statement resource
  oci_execute($p_row, OCI_DEFAULT);
  oci_fetch_all($p_row, $getSecretsForVerifyList, null, null, OCI_FETCHSTATEMENT_BY_ROW);
  $rs = $getSecretsForVerifyList;
  if (empty($rs)) {
    throw new OAuthException2('The consumer_key "' . $consumer_key . '" token "' . $token . '" combination does not exist or is not enabled.');
  }
  return $rs[0];
}