Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Session/SessionConfiguration.php \Drupal\Core\Session\SessionConfiguration::getName()
  2. 9 core/lib/Drupal/Core/Session/SessionConfiguration.php \Drupal\Core\Session\SessionConfiguration::getName()

Returns the session cookie name.

Parameters

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

Return value

string The name of the session cookie.

2 calls to SessionConfiguration::getName()
SessionConfiguration::getOptions in core/lib/Drupal/Core/Session/SessionConfiguration.php
SessionConfiguration::hasSession in core/lib/Drupal/Core/Session/SessionConfiguration.php

File

core/lib/Drupal/Core/Session/SessionConfiguration.php, line 68

Class

SessionConfiguration
Defines the default session configuration generator.

Namespace

Drupal\Core\Session

Code

protected function getName(Request $request) {

  // To prevent session cookies from being hijacked, a user can configure the
  // SSL version of their website to only transfer session cookies via SSL by
  // using PHP's session.cookie_secure setting. The browser will then use two
  // separate session cookies for the HTTPS and HTTP versions of the site. So
  // we must use different session identifiers for HTTPS and HTTP to prevent a
  // cookie collision.
  $prefix = $request
    ->isSecure() ? 'SSESS' : 'SESS';
  return $prefix . $this
    ->getUnprefixedName($request);
}