You are here

public function Oauth::setAuthFinishRedirect in Media: Acquia DAM 8

File

src/Oauth.php, line 224

Class

Oauth
OAuth Class.

Namespace

Drupal\media_acquiadam

Code

public function setAuthFinishRedirect($authFinishRedirect) {
  $parsed_url = UrlHelper::parse($authFinishRedirect);
  $filterable_keys = $this->config
    ->get('oauth.excluded_redirect_keys');
  if (empty($filterable_keys) || !is_array($filterable_keys)) {
    $filterable_keys = [
      // The Entity Browser Block module will break the authentication flow
      // when used within Panels IPE. Filtering out this query parameter
      // works around the issue.
      'original_path',
    ];
  }
  $this->authFinishRedirect = Url::fromUri('base:' . $parsed_url['path'], [
    'query' => UrlHelper::filterQueryParameters($parsed_url['query'], $filterable_keys),
    'fragment' => $parsed_url['fragment'],
  ])
    ->toString();
}