Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-12-03 15:40:45 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-12-03 15:40:45 +0300
commitfe4b5c98201a92ab74b1a0648e2d881feb306ee5 (patch)
tree13bab3925e33a50e13708255439d735f4ba9e8e2 /app/models/concerns/token_authenticatable_strategies
parent0f5073d9bb2dc5c7677c31605d66e2cc30f48d1f (diff)
Fix token encrypted strategy when migrating data
Diffstat (limited to 'app/models/concerns/token_authenticatable_strategies')
-rw-r--r--app/models/concerns/token_authenticatable_strategies/encrypted.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/concerns/token_authenticatable_strategies/encrypted.rb b/app/models/concerns/token_authenticatable_strategies/encrypted.rb
index 4659109ca8f..35ee0193dc6 100644
--- a/app/models/concerns/token_authenticatable_strategies/encrypted.rb
+++ b/app/models/concerns/token_authenticatable_strategies/encrypted.rb
@@ -19,11 +19,17 @@ module TokenAuthenticatableStrategies
.find_by(encrypted_field => encrypted_value)
end
- if migrating? || fallback?
+ if fallback? || migrating?
token_authenticatable ||= fallback_strategy
.find_token_authenticatable(token)
end
+ if migrating?
+ encrypted_value = Gitlab::CryptoHelper.aes256_gcm_encrypt(token)
+ token_authenticatable ||= relation(unscoped)
+ .find_by(encrypted_field => encrypted_value)
+ end
+
token_authenticatable
end