/**
  * Handle an user authorization request.
  *
  * Parses an authorization request. This includes OAuth and OMB
  * verification.
  * Throws exceptions on failures. Returns an OMB_Profile object representing
  * the remote user.
  *
  * The OMB_Profile passed to the constructor of OMB_Service_Provider should
  * not represent the user specified in the authorization request, but the
  * one currently logged in to the service. This condition being satisfied,
  * handleUserAuth will check whether the listener specified in the request
  * is identical to the logged in user.
  *
  * @access public
  *
  * @return OMB_Profile The profile of the soon-to-be subscribed, i. e.
  *                     remote user
  */
 public function handleUserAuth()
 {
     OMB_Helper::removeMagicQuotesFromRequest();
     /* Verify the request token. */
     $this->token = $this->datastore->lookup_token(null, "request", $_GET['oauth_token']);
     if (is_null($this->token)) {
         throw new OAuthException('The given request token has not been ' . 'issued by this service.');
     }
     /* Verify the OMB part. */
     if ($_GET['omb_version'] !== OMB_VERSION) {
         throw OMB_RemoteServiceException::forRequest(OAUTH_ENDPOINT_AUTHORIZE, 'Wrong OMB version ' . $_GET['omb_version']);
     }
     if ($_GET['omb_listener'] !== $this->user->getIdentifierURI()) {
         throw OMB_RemoteServiceException::forRequest(OAUTH_ENDPOINT_AUTHORIZE, 'Wrong OMB listener ' . $_GET['omb_listener']);
     }
     foreach (array('omb_listenee', 'omb_listenee_profile', 'omb_listenee_nickname', 'omb_listenee_license') as $param) {
         if (!isset($_GET[$param]) || is_null($_GET[$param])) {
             throw OMB_RemoteServiceException::forRequest(OAUTH_ENDPOINT_AUTHORIZE, "Required parameter '{$param}' not found");
         }
     }
     /* Store given callback for later use. */
     if (isset($_GET['oauth_callback']) && $_GET['oauth_callback'] !== '') {
         $this->callback = $_GET['oauth_callback'];
         if (!OMB_Helper::validateURL($this->callback)) {
             throw OMB_RemoteServiceException::forRequest(OAUTH_ENDPOINT_AUTHORIZE, 'Invalid callback URL specified');
         }
     }
     $this->remote_user = OMB_Profile::fromParameters($_GET, 'omb_listenee');
     return $this->remote_user;
 }
 public function setSeealsoLicenseURL($seealso_license_url)
 {
     if ($seealso_license_url === '') {
         $seealso_license_url = null;
     } elseif (!OMB_Helper::validateURL($seealso_license_url)) {
         throw new OMB_InvalidParameterException($seealso_license_url, 'notice', 'omb_seealso_license');
     }
     $this->seealso_license_url = $seealso_license_url;
     $this->param_array = false;
 }
 public function setAvatarURL($avatar_url)
 {
     if ($avatar_url === '') {
         $avatar_url = null;
     } elseif (!OMB_Helper::validateURL($avatar_url)) {
         throw new OMB_InvalidParameterException($avatar_url, 'profile', 'omb_listenee_avatar or omb_listener_avatar');
     }
     $this->avatar_url = $avatar_url;
     $this->param_array = false;
 }