You are here

public function KeycloakService::getSessionInfo in Keycloak OpenID Connect 8

Return an associative array of Keycloak session information.

Parameters

array|null $keys: (optional) Array of session info keys to retrieve or NULL. If no keys are provided, the entire session info will be returned. Defaults to NULL.

Return value

array Associative array of Keycloak session information.

Overrides KeycloakServiceInterface::getSessionInfo

1 call to KeycloakService::getSessionInfo()
KeycloakService::setSessionInfo in src/Service/KeycloakService.php
Store the Keycloak session information to the user session.

File

src/Service/KeycloakService.php, line 165

Class

KeycloakService
Keycloak service.

Namespace

Drupal\keycloak\Service

Code

public function getSessionInfo($keys = NULL) {
  $session_info = [];
  if (!$this
    ->isKeycloakUser()) {
    return $session_info;
  }
  $default_keys = $this
    ->getSessionInfoDefaultKeys();
  $keys = empty($keys) ? $default_keys : array_intersect($default_keys, $keys);
  $tempstore = $this->privateTempstore
    ->get('keycloak');
  foreach ($keys as $key) {
    $session_info[$key] = $tempstore
      ->get($key);
  }
  return $session_info;
}