Exemple #1
0
 public function getToken()
 {
     if (!isset($this->session['request_token'])) {
         $this->session['request_token'] = Binary::base64Encode(Random::bytes(32), true);
     }
     return $this->session['request_token'];
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function createSession($userData, $validUntil)
 {
     $sessionId = Binary::base64Encode(Random::bytes(32), true);
     $this->lock['session'] = $sessionId;
     $this->lock->save();
     return $sessionId;
 }
Exemple #3
0
 /**
  * Generate a random salt.
  * @return string Salt.
  */
 public function genSalt()
 {
     $bytes = Random::bytes($this->saltLength);
     $b64 = rtrim(base64_encode($bytes), '=');
     $salt = Binary::slice(str_replace('+', '.', $b64), 0, $this->saltLength);
     return $this->prefix . $salt;
 }