You are here

class CookieSameSiteSessionConfiguration in Media: Acquia DAM 8

Defines the default session configuration generator.

Hierarchy

Expanded class hierarchy of CookieSameSiteSessionConfiguration

1 string reference to 'CookieSameSiteSessionConfiguration'
media_acquiadam.services.yml in ./media_acquiadam.services.yml
media_acquiadam.services.yml
1 service uses CookieSameSiteSessionConfiguration
media_acquiadam.cookie_samesite.session_configuration in ./media_acquiadam.services.yml
Drupal\media_acquiadam\Session\CookieSameSiteSessionConfiguration

File

src/Session/CookieSameSiteSessionConfiguration.php, line 11

Namespace

Drupal\media_acquiadam\Session
View source
class CookieSameSiteSessionConfiguration extends SessionConfiguration {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CookieSameSiteSessionConfiguration::getOptions public function Returns a list of options suitable for passing to the session storage. Overrides SessionConfiguration::getOptions
SessionConfiguration::$options protected property An associative array of session ini settings.
SessionConfiguration::drupalValidTestUa protected function Wraps drupal_valid_test_ua().
SessionConfiguration::getCookieDomain protected function Return the session cookie domain.
SessionConfiguration::getName protected function Returns the session cookie name.
SessionConfiguration::getUnprefixedName protected function Returns the session cookie name without the secure/insecure prefix.
SessionConfiguration::hasSession public function Determines whether a session identifier is on the request. Overrides SessionConfigurationInterface::hasSession
SessionConfiguration::__construct public function Constructs a new session configuration instance.