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-11-23 12:25:36 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-11-23 12:25:52 +0300
commit636b038e01c7064c6d1a88359f0370dbefc323e1 (patch)
treea22bfcec8fda9c806d0c935b92ffed59bbf703b6 /app/models/concerns/token_authenticatable_strategies/base.rb
parentd31a3873f4e25697bb65a00cb9cf7cdd0bdb6a5f (diff)
Only allow valid options when configuring tokens
Diffstat (limited to 'app/models/concerns/token_authenticatable_strategies/base.rb')
-rw-r--r--app/models/concerns/token_authenticatable_strategies/base.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/concerns/token_authenticatable_strategies/base.rb b/app/models/concerns/token_authenticatable_strategies/base.rb
index c2c644558c0..23ee34962c7 100644
--- a/app/models/concerns/token_authenticatable_strategies/base.rb
+++ b/app/models/concerns/token_authenticatable_strategies/base.rb
@@ -48,6 +48,10 @@ module TokenAuthenticatableStrategies
end
def self.fabricate(instance, field, options)
+ if options[:digest] && options[:encrypted]
+ raise ArgumentError, 'Incompatible options set!'
+ end
+
if options[:digest]
TokenAuthenticatableStrategies::Digest.new(instance, field, options)
elsif options[:encrypted]