/** * Builds the URL the client needs to visit to approve access. */ private function buildAznUrl() { // At some point we can be clever and use a callback URL to improve // the user experience, but that's too complex for now. $accessor = $this->accessorInfo->getAccessor(); $azn = $accessor->consumer->callback_url->userAuthorizationURL; $authUrl = $azn->url; if (strstr($authUrl, "?") == FALSE) { $authUrl .= "?"; } else { $authUrl .= "&"; } $authUrl .= ShindigOAuth::$OAUTH_TOKEN; $authUrl .= "="; $authUrl .= ShindigOAuthUtil::urlencode_rfc3986($accessor->requestToken); $this->aznUrl = $authUrl; }
/** * Needed in OAuthFetcher.php * * Parse the parameters from an OAuth Authorization or WWW-Authenticate * header. The realm is included as a parameter. If the given header doesn't * start with "OAuth ", return an empty list. * * @param string $authorization * @return array */ public static function decodeAuthorization($authorization) { $into = array(); if ($authorization != null) { $m = ereg(ShindigOAuthUtil::$AUTHORIZATION, $authorization); if ($m !== false) { if (strpos($authorization, ShindigOAuthUtil::$AUTH_SCHEME) == 0) { $authorization = str_replace("OAuth ", "", $authorization); $authParams = explode(", ", $authorization); foreach ($authParams as $params) { $m = ereg(ShindigOAuthUtil::$NVP, $params); if ($m == 1) { $keyValue = explode("=", $params); $name = ShindigOAuthUtil::urlencode_rfc3986($keyValue[0]); $value = ShindigOAuthUtil::urlencode_rfc3986(str_replace("\"", "", $keyValue[1])); $into[$name] = $value; } } } } } return $into; }