Skip to content

Commit 7b62cc5

Browse files
author
Francesco Placella
committed
I-51: Fixed cookie hash validation.
1 parent d592188 commit 7b62cc5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/Auth/Source/External.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,12 @@ private function getUser()
128128
// make sure the hash matches
129129
// make sure the UID is passed
130130
if ((isset($cookie_hash) && !empty($cookie_hash)) && (isset($uid) && !empty($uid))) {
131+
$drupalHelper = new DrupalHelper();
132+
$drupalHelper->bootDrupal($this->config->getDrupalroot());
133+
131134
// Make sure no one manipulated the hash or the uid in the cookie before we trust the uid
132135
$hash = Crypt::hmacBase64(
133-
$account->id(),
136+
$uid,
134137
$this->config->getCookieSalt() . \Drupal::service('private_key')->get()
135138
);
136139
if (!Crypt::hashEquals($hash, $cookie_hash)) {
@@ -149,9 +152,6 @@ private function getUser()
149152
}
150153

151154
if (!empty($drupaluid)) {
152-
$drupalHelper = new DrupalHelper();
153-
$drupalHelper->bootDrupal($this->config->getDrupalroot());
154-
155155
// Load the user object from Drupal.
156156
$drupaluser = User::load($uid);
157157
if ($drupaluser->isBlocked()) {

0 commit comments

Comments
 (0)