You are here

public function HashService::getHash in Fast Autocomplete 8

Returns a hash.

Return value

string The requested hash.

Overrides HashServiceInterface::getHash

1 call to HashService::getHash()
HashService::isValidHash in src/HashService.php
Validates if the given hash is valid.

File

src/HashService.php, line 50

Class

HashService
Class HashService.

Namespace

Drupal\fac

Code

public function getHash() {
  $rids = $this->currentUser
    ->getRoles();
  sort($rids);

  // Prevent user 1 accounts without the administrator role leaking
  // information via DRUPAL_AUTHENTICATED_RID.
  if ($this->currentUser
    ->id() === 1) {
    $rids[] = 'fac_#_dummy_role';
  }
  $hash = Crypt::hmacBase64('fac-' . implode('|', $rids), $this
    ->getKey());
  return $hash;
}