Skip to content

Instantly share code, notes, and snippets.

@damiankloip
Created April 27, 2014 15:06
Show Gist options
  • Save damiankloip/11347808 to your computer and use it in GitHub Desktop.
Save damiankloip/11347808 to your computer and use it in GitHub Desktop.
diff --git a/core/lib/Drupal/Core/Access/CsrfTokenGenerator.php b/core/lib/Drupal/Core/Access/CsrfTokenGenerator.php
index 37a141f..c260a31 100644
--- a/core/lib/Drupal/Core/Access/CsrfTokenGenerator.php
+++ b/core/lib/Drupal/Core/Access/CsrfTokenGenerator.php
@@ -20,18 +20,18 @@
class CsrfTokenGenerator {
/**
- * The private key service.
+ * The private key.
*
- * @var \Drupal\Core\PrivateKey
+ * @var string
*/
protected $privateKey;
/**
- * The settings instance.
+ * The hash salt.
*
- * @var \Drupal\Core\Site\Settings
+ * @var string
*/
- protected $settings;
+ protected $hashSalt;
/**
* Constructs the token generator.
@@ -42,8 +42,8 @@ class CsrfTokenGenerator {
* The settings instance.
*/
public function __construct(PrivateKey $private_key, Settings $settings) {
- $this->privateKey = $private_key;
- $this->settings = $settings;
+ $this->privateKey = $private_key->get();
+ $this->hashsalt = $settings->getHashSalt();
}
/**
@@ -66,7 +66,7 @@ public function __construct(PrivateKey $private_key, Settings $settings) {
* @see \Drupal\Core\Session\SessionManager::start()
*/
public function get($value = '') {
- return Crypt::hmacBase64($value, session_id() . $this->privateKey->get() . $this->settings->getHashSalt());
+ return Crypt::hmacBase64($value, session_id() . $this->privateKey . $this->hashSalt);
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment