You are here

private function AuthController::getRandomBytes in Auth0 Single Sign On 8

Same name and namespace in other branches
  1. 8.2 src/Controller/AuthController.php \Drupal\auth0\Controller\AuthController::getRandomBytes()
1 call to AuthController::getRandomBytes()
AuthController::generatePassword in src/Controller/AuthController.php

File

src/Controller/AuthController.php, line 461

Class

AuthController
Controller routines for auth0 authentication.

Namespace

Drupal\auth0\Controller

Code

private function getRandomBytes($nbBytes = 32) {
  $bytes = openssl_random_pseudo_bytes($nbBytes, $strong);
  if (false !== $bytes && true === $strong) {
    return $bytes;
  }
  else {
    throw new \Exception("Unable to generate secure token from OpenSSL.");
  }
}