You are here

public function KeycloakService::isKeycloakUser in Keycloak OpenID Connect 8

Whether the currently logged in user was logged in using Keycloak.

Return value

bool TRUE, if user was logged in using Keycloak, FALSE otherwise.

Overrides KeycloakServiceInterface::isKeycloakUser

1 call to KeycloakService::isKeycloakUser()
KeycloakService::getSessionInfo in src/Service/KeycloakService.php
Return an associative array of Keycloak session information.

File

src/Service/KeycloakService.php, line 131

Class

KeycloakService
Keycloak service.

Namespace

Drupal\keycloak\Service

Code

public function isKeycloakUser() {

  // Whether the user is not authenticated or the Keycloak client disabled.
  if (!$this->currentUser
    ->isAuthenticated() || !$this
    ->isEnabled()) {
    return FALSE;
  }

  // If the user was logged in using Keycloak, we will find session
  // information in the users' private tempstore.
  $tempstore = $this->privateTempstore
    ->get('keycloak');
  return !empty($tempstore);
}