diff options
author | Valery Sizov <valery@gitlab.com> | 2019-05-21 18:04:09 +0300 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-05-22 16:11:08 +1000 |
commit | 07a353259424cd225368ca4af59883eebf10066d (patch) | |
tree | dd68c834f37a6c20b20c2fada25d83b18663eec1 /lib | |
parent | c342c07899ef6637eef7c1df2534f0c5ea67d7bd (diff) | |
download | gitlab-ce-07a353259424cd225368ca4af59883eebf10066d.tar.gz |
Geo: Remove Gitlab::LfsToken::LegacyRedisDeviseToken implementation
We kept it for smooth update only
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/lfs_token.rb | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/lib/gitlab/lfs_token.rb b/lib/gitlab/lfs_token.rb index 31e6fc9d8c7..124e34562c1 100644 --- a/lib/gitlab/lfs_token.rb +++ b/lib/gitlab/lfs_token.rb @@ -35,8 +35,7 @@ module Gitlab end def token_valid?(token_to_check) - HMACToken.new(actor).token_valid?(token_to_check) || - LegacyRedisDeviseToken.new(actor).token_valid?(token_to_check) + HMACToken.new(actor).token_valid?(token_to_check) end def deploy_key_pushable?(project) @@ -103,44 +102,5 @@ module Gitlab Settings.attr_encrypted_db_key_base.first(16) end end - - # TODO: LegacyRedisDeviseToken and references need to be removed after - # next released milestone - # - class LegacyRedisDeviseToken - TOKEN_LENGTH = 50 - DEFAULT_EXPIRY_TIME = 1800 * 1000 # 30 mins - - def initialize(actor) - @actor = actor - end - - def token_valid?(token_to_check) - Devise.secure_compare(stored_token, token_to_check) - end - - def stored_token - Gitlab::Redis::SharedState.with { |redis| redis.get(state_key) } - end - - # This method exists purely to facilitate legacy testing to ensure the - # same redis key is used. - # - def store_new_token(expiry_time_in_ms = DEFAULT_EXPIRY_TIME) - Gitlab::Redis::SharedState.with do |redis| - new_token = Devise.friendly_token(TOKEN_LENGTH) - redis.set(state_key, new_token, px: expiry_time_in_ms) - new_token - end - end - - private - - attr_reader :actor - - def state_key - "gitlab:lfs_token:#{actor.class.name.underscore}_#{actor.id}" - end - end end end |