Пример #1
0
 /**
  * After a Request Token is retrieved, the user may be redirected to the
  * OAuth Provider to authorize the application's access to their
  * protected resources - the redirect URL being provided by this method.
  * Once the user has authorized the application for access, they are
  * redirected back to the application which can now exchange the previous
  * Request Token for a fully authorized Access Token.
  *
  * @param  null|array $customServiceParameters
  * @param  null|Zend_Oauth_Token_Request $token
  * @param  null|Zend_OAuth_Http_UserAuthorization $redirect
  * @return string
  */
 public function getRedirectUrl(array $customServiceParameters = null, Zend_Oauth_Token_Request $token = null, Zend_Oauth_Http_UserAuthorization $redirect = null)
 {
     if ($redirect === null) {
         $redirect = new Zend_Oauth_Http_UserAuthorization($this, $customServiceParameters);
     } elseif ($customServiceParameters !== null) {
         $redirect->setParameters($customServiceParameters);
     }
     if ($token !== null) {
         $this->_requestToken = $token;
     }
     return $redirect->getUrl();
 }
 public function testGetUrlReturnsEncodedQueryStringParamsAppendedToLocalUrl()
 {
     $redirect = new Zend_Oauth_Http_UserAuthorization($this->stubConsumer, array('foo ' => 'bar~'));
     $expected = 'http://www.example.com/authorize?oauth_token=1234567890&oauth_callback=http%3A%2F%2Fwww.example.com%2Flocal&foo%20=bar~';
     $this->assertEquals($expected, $redirect->getUrl());
 }