/** * Creates URI factory for building urls * Setups session storage * * @param DiInterface $di * @param TokenStorageInterface $sessionStorage */ public function __construct(DiInterface $di, TokenStorageInterface $sessionStorage) { $this->setDI($di); $uriFactory = new \OAuth\Common\Http\Uri\UriFactory(); $this->currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER); $this->currentUri->setQuery(''); $this->sessionStorage = $sessionStorage; }
/** * Returns the cached current_uri object or creates and caches it if it is * not already created. In each case the query string is updated based on * the $query parameter. * * @param string $service_name The name of the service * @param string $query The query string of the current_uri * used in redirects * @return \OAuth\Common\Http\Uri\UriInterface */ protected function get_current_uri($service_name, $query) { if ($this->current_uri) { $this->current_uri->setQuery($query); return $this->current_uri; } $uri_factory = new \OAuth\Common\Http\Uri\UriFactory(); $current_uri = $uri_factory->createFromSuperGlobalArray($this->request->get_super_global(\phpbb\request\request_interface::SERVER)); $current_uri->setQuery($query); $this->current_uri = $current_uri; return $current_uri; }
/** * Returns the cached current_uri object or creates and caches it if it is * not already created. In each case the query string is updated based on * the $query parameter. * * @param string $service_name The name of the service * @param string $query The query string of the current_uri * used in redirects * @return \OAuth\Common\Http\Uri\UriInterface */ protected function get_current_uri($service_name, $query) { if ($this->current_uri) { $this->current_uri->setQuery($query); return $this->current_uri; } $uri_factory = new \OAuth\Common\Http\Uri\UriFactory(); $super_globals = $this->request->get_super_global(\phpbb\request\request_interface::SERVER); if (!empty($super_globals['HTTP_X_FORWARDED_PROTO']) && $super_globals['HTTP_X_FORWARDED_PROTO'] === 'https') { $super_globals['HTTPS'] = 'on'; $super_globals['SERVER_PORT'] = 443; } $current_uri = $uri_factory->createFromSuperGlobalArray($super_globals); $current_uri->setQuery($query); $this->current_uri = $current_uri; return $current_uri; }