public function sign($request, $consumer, $token) { $signature = array(Horde_Oauth_Utils::urlencodeRfc3986($consumer->secret)); if ($token) { $signature[] = Horde_Oauth_Utils::urlencodeRfc3986($token->secret); } else { $signature[] = ''; } return Horde_Oauth_Utils::urlencodeRfc3986(implode('&', $signature)); }
/** */ public function buildAuthorizationHeader($realm = '') { $header = ''; foreach ($this->_params as $k => $v) { if (strpos($k, 'oauth_') !== false) { $header .= Horde_Oauth_Utils::urlencodeRfc3986($k) . '="' . Horde_Oauth_Utils::urlencodeRfc3986($v) . '",'; } } $header = substr($header, 0, -1); if (!empty($realm)) { $header .= ',realm="' . Horde_Oauth_Utils::urlencodeRfc3986($realm) . '"'; } return 'OAuth ' . $header; }
/** * Generate the basic string serialization of a token that a server would * respond to request_token and access_token calls with. */ public function __toString() { return 'oauth_token=' . Horde_Oauth_Utils::urlencodeRfc3986($this->key) . '&oauth_token_secret=' . Horde_Oauth_Utils::urlencodeRfc3986($this->secret); }