summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Core/Authentication/Token/AbstractToken.php2
-rw-r--r--Core/Authentication/Token/PreAuthenticatedToken.php7
-rw-r--r--Core/Util/SecureRandom.php12
-rw-r--r--Resources/translations/security.tr.xlf12
-rw-r--r--composer.json3
5 files changed, 24 insertions, 12 deletions
diff --git a/Core/Authentication/Token/AbstractToken.php b/Core/Authentication/Token/AbstractToken.php
index a2aefb1..b07312f 100644
--- a/Core/Authentication/Token/AbstractToken.php
+++ b/Core/Authentication/Token/AbstractToken.php
@@ -33,7 +33,7 @@ abstract class AbstractToken implements TokenInterface
/**
* Constructor.
*
- * @param RoleInterface[] $roles An array of roles
+ * @param RoleInterface[]|string[] $roles An array of roles
*
* @throws \InvalidArgumentException
*/
diff --git a/Core/Authentication/Token/PreAuthenticatedToken.php b/Core/Authentication/Token/PreAuthenticatedToken.php
index abcd2bf..1798203 100644
--- a/Core/Authentication/Token/PreAuthenticatedToken.php
+++ b/Core/Authentication/Token/PreAuthenticatedToken.php
@@ -11,6 +11,8 @@
namespace Symfony\Component\Security\Core\Authentication\Token;
+use Symfony\Component\Security\Core\Role\RoleInterface;
+
/**
* PreAuthenticatedToken implements a pre-authenticated token.
*
@@ -23,6 +25,11 @@ class PreAuthenticatedToken extends AbstractToken
/**
* Constructor.
+ *
+ * @param string|object $user The user
+ * @param mixed $credentials The user credentials
+ * @param string $providerKey The provider key
+ * @param RoleInterface[]|string[] $roles An array of roles
*/
public function __construct($user, $credentials, $providerKey, array $roles = array())
{
diff --git a/Core/Util/SecureRandom.php b/Core/Util/SecureRandom.php
index c0924df..3461b4e 100644
--- a/Core/Util/SecureRandom.php
+++ b/Core/Util/SecureRandom.php
@@ -42,12 +42,12 @@ final class SecureRandom implements SecureRandomInterface
$this->seedFile = $seedFile;
$this->logger = $logger;
+ $isUnsupportedPhp = '\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50304;
+
// determine whether to use OpenSSL
- if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50304) {
- $this->useOpenSsl = false;
- } elseif (!function_exists('openssl_random_pseudo_bytes')) {
+ if (!function_exists('random_bytes') && ($isUnsupportedPhp || !function_exists('openssl_random_pseudo_bytes'))) {
if (null !== $this->logger) {
- $this->logger->notice('It is recommended that you enable the "openssl" extension for random number generation.');
+ $this->logger->notice('It is recommended that you install the "paragonie/random_compat" library or enable the "openssl" extension for random number generation.');
}
$this->useOpenSsl = false;
} else {
@@ -60,6 +60,10 @@ final class SecureRandom implements SecureRandomInterface
*/
public function nextBytes($nbBytes)
{
+ if (function_exists('random_bytes')) {
+ return random_bytes($nbBytes);
+ }
+
// try OpenSSL
if ($this->useOpenSsl) {
$bytes = openssl_random_pseudo_bytes($nbBytes, $strong);
diff --git a/Resources/translations/security.tr.xlf b/Resources/translations/security.tr.xlf
index fbf9b26..68c4421 100644
--- a/Resources/translations/security.tr.xlf
+++ b/Resources/translations/security.tr.xlf
@@ -8,7 +8,7 @@
</trans-unit>
<trans-unit id="2">
<source>Authentication credentials could not be found.</source>
- <target>Yetkilendirme girdileri bulunamadı.</target>
+ <target>Kimlik bilgileri bulunamadı.</target>
</trans-unit>
<trans-unit id="3">
<source>Authentication request could not be processed due to a system problem.</source>
@@ -16,7 +16,7 @@
</trans-unit>
<trans-unit id="4">
<source>Invalid credentials.</source>
- <target>Geçersiz girdiler.</target>
+ <target>Geçersiz kimlik bilgileri.</target>
</trans-unit>
<trans-unit id="5">
<source>Cookie has already been used by someone else.</source>
@@ -32,7 +32,7 @@
</trans-unit>
<trans-unit id="8">
<source>Digest nonce has expired.</source>
- <target>Derleme zaman aşımı gerçekleşti.</target>
+ <target>Derleme zaman aşımına uğradı.</target>
</trans-unit>
<trans-unit id="9">
<source>No authentication provider found to support the authentication token.</source>
@@ -44,7 +44,7 @@
</trans-unit>
<trans-unit id="11">
<source>No token could be found.</source>
- <target>Bilet bulunamadı.</target>
+ <target>Fiş bulunamadı.</target>
</trans-unit>
<trans-unit id="12">
<source>Username could not be found.</source>
@@ -56,11 +56,11 @@
</trans-unit>
<trans-unit id="14">
<source>Credentials have expired.</source>
- <target>Girdiler zaman aşımına uğradı.</target>
+ <target>Kimlik bilgileri zaman aşımına uğradı.</target>
</trans-unit>
<trans-unit id="15">
<source>Account is disabled.</source>
- <target>Hesap devre dışı bırakılmış.</target>
+ <target>Hesap engellenmiş.</target>
</trans-unit>
<trans-unit id="16">
<source>Account is locked.</source>
diff --git a/composer.json b/composer.json
index d18b644..2026fc4 100644
--- a/composer.json
+++ b/composer.json
@@ -39,7 +39,8 @@
"symfony/validator": "",
"symfony/routing": "",
"doctrine/dbal": "to use the built-in ACL implementation",
- "ircmaxell/password-compat": ""
+ "ircmaxell/password-compat": "",
+ "paragonie/random_compat": ""
},
"autoload": {
"psr-0": { "Symfony\\Component\\Security\\": "" }