You are here

public function CookieSameSiteSessionConfiguration::getOptions in Media: Acquia DAM 8

Returns a list of options suitable for passing to the session storage.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request.

Return value

array An associative array of session ini settings.

Overrides SessionConfiguration::getOptions

See also

\Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage::__construct()

File

src/Session/CookieSameSiteSessionConfiguration.php, line 16

Class

CookieSameSiteSessionConfiguration
Defines the default session configuration generator.

Namespace

Drupal\media_acquiadam\Session

Code

public function getOptions(Request $request) {
  $options = parent::getOptions($request);

  // Return defaults if configuration tells us to disable the bypass.
  $config = \Drupal::configFactory()
    ->getEditable('media_acquiadam.settings');
  if ($config
    ->get('samesite_cookie_disable')) {
    return $options;
  }

  // Set the cookie samesite option to None.
  if (isset($options['cookie_secure']) && $options['cookie_secure'] == TRUE) {
    $options['cookie_samesite'] = 'None';
  }
  return $options;
}