SessionConfiguration::getUnprefixedName

protected SessionConfiguration::getUnprefixedName(Request $request)

Returns the session cookie name without the secure/insecure prefix.

@returns string The session name without the prefix (SESS/SSESS).

Parameters

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

File

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

Class

SessionConfiguration
Defines the default session configuration generator.

Namespace

Drupal\Core\Session

Code

protected function getUnprefixedName(Request $request) {
  if ($test_prefix = $this->drupalValidTestUa()) {
    $session_name = $test_prefix;
  }
  elseif (isset($this->options['cookie_domain'])) {
    // If the user specifies the cookie domain, also use it for session name.
    $session_name = $this->options['cookie_domain'];
  }
  else {
    // Otherwise use $base_url as session name, without the protocol
    // to use the same session identifiers across HTTP and HTTPS.
    $session_name = $request->getHost() . $request->getBasePath();
    // Replace "core" out of session_name so core scripts redirect properly,
    // specifically install.php.
    $session_name = preg_replace('#/core$#', '', $session_name);
  }

  return substr(hash('sha256', $session_name), 0, 32);
}
doc_Drupal
2016-10-29 09:41:59
Comments
Leave a Comment

Please login to continue.