You are here

function saml_sp_get_tempstore in SAML Service Provider 8.2

Same name and namespace in other branches
  1. 8.3 saml_sp.module \saml_sp_get_tempstore()
  2. 4.x saml_sp.module \saml_sp_get_tempstore()
  3. 3.x saml_sp.module \saml_sp_get_tempstore()

get the appropriate tempstore for the version of Drupal we are using

3 calls to saml_sp_get_tempstore()
SamlSPController::consume in src/Controller/SamlSPController.php
receive data back from the IdP
saml_sp__get_tracked_request in ./saml_sp.module
Get the IDP and callback from a tracked request.
saml_sp__track_request in ./saml_sp.module
Track an outbound request.

File

./saml_sp.module, line 300
SAML Service Provider

Code

function saml_sp_get_tempstore($name) {

  // determine is the Drupal version is one that has 'tempstore.shared' and use it,
  // otherwise use 'user.shared_tempstore'
  switch (version_compare(Drupal::VERSION, '8.5.0')) {
    case -1:

      // Drupal::Version is less than 8.5.0
      $service = 'user.shared_tempstore';
      break;
    default:

      // Drupal::VERSION is greater than or equal to
      $service = 'tempstore.shared';
  }
  $factory = \Drupal::service($service);
  $store = $factory
    ->get('saml_sp.' . $name);
  return $store;
}