added a SecureRandomInterface
This commit is contained in:
parent
234f7255bb
commit
5cdf696bde
@ -19,7 +19,7 @@ use Symfony\Component\HttpKernel\Log\LoggerInterface;
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
|
||||
*/
|
||||
final class SecureRandom
|
||||
final class SecureRandom implements SecureRandomInterface
|
||||
{
|
||||
private $logger;
|
||||
private $useOpenSsl;
|
||||
@ -56,10 +56,7 @@ final class SecureRandom
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the specified number of secure random bytes.
|
||||
*
|
||||
* @param integer $nbBytes
|
||||
* @return string
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function nextBytes($nbBytes)
|
||||
{
|
||||
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Security\Core\Util;
|
||||
|
||||
use Symfony\Component\HttpKernel\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* A secure random number generator implementation.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
interface SecureRandomInterface
|
||||
{
|
||||
/**
|
||||
* Generates the specified number of secure random bytes.
|
||||
*
|
||||
* @param integer $nbBytes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function nextBytes($nbBytes);
|
||||
}
|
@ -19,7 +19,7 @@ use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||
use Symfony\Component\Security\Core\Exception\CookieTheftException;
|
||||
use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Util\SecureRandom;
|
||||
use Symfony\Component\Security\Core\Util\SecureRandomInterface;
|
||||
|
||||
/**
|
||||
* Concrete implementation of the RememberMeServicesInterface which needs
|
||||
@ -43,7 +43,7 @@ class PersistentTokenBasedRememberMeServices extends AbstractRememberMeServices
|
||||
* @param array $options
|
||||
* @param LoggerInterface $logger
|
||||
*/
|
||||
public function __construct(array $userProviders, $key, $providerKey, array $options = array(), LoggerInterface $logger = null, SecureRandom $secureRandom)
|
||||
public function __construct(array $userProviders, $key, $providerKey, array $options = array(), LoggerInterface $logger = null, SecureRandomInterface $secureRandom)
|
||||
{
|
||||
parent::__construct($userProviders, $key, $providerKey, $options, $logger);
|
||||
|
||||
|
Reference in New Issue
Block a user