You are here

function _esi__get_seed in ESI: Edge Side Includes 7.3

Get the current short-term rotating-seed, which provides the security that users with expired credentials have limited access to secured data.

Return value

String The new 32-character seed key.

1 call to _esi__get_seed()
esi_esi_context_cookies_alter in ./esi.module
Implements hook_esi_context_cookies_alter().

File

./esi.module, line 533
Adds support for ESI (Edge-Side-Include) integration, allowing components\ to be delivered by ESI, with support for per-component cache times.

Code

function _esi__get_seed() {

  // Attempt to load the current seed key.
  $seed = variable_get('esi_seed_key', FALSE);

  // If the seed hasn't yet been set, or is too old, rotate the key.
  $age = variable_get('esi_seed_key_last_changed', 0);
  if (empty($seed) || $age < variable_get('esi_seed_key_rotation_interval', ESI_SEED_ROTATION_INTERVAL)) {
    $seed = _esi__rotate_seed_key();
  }
  return $seed;
}