summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2019-07-05 08:08:24 +0000
committerBob Van Landuyt <bob@gitlab.com>2019-07-05 08:08:24 +0000
commit2fec78ead4ce46b9728be02693b6e50cce740726 (patch)
tree21273ab81ccc563571da6b5705fe4b1bb1c4e9c5 /lib
parent2e74680358353ee8b258adf2ca1cda422389fc89 (diff)
parentb9b3ec83540a82fc96ddd64715a51d7adeb7312c (diff)
downloadgitlab-ce-12-1-stable-prepare-rc1.tar.gz
Merge branch 'if-6990-enforce_smartcard_session_for_git_and_api' into 'master'12-1-stable-prepare-rc1
CE port of "Require session with smartcard login for Git access" See merge request gitlab-org/gitlab-ce!30384
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/namespaced_session_store.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/gitlab/namespaced_session_store.rb b/lib/gitlab/namespaced_session_store.rb
index 34520078bfb..f0f24c081c3 100644
--- a/lib/gitlab/namespaced_session_store.rb
+++ b/lib/gitlab/namespaced_session_store.rb
@@ -4,19 +4,24 @@ module Gitlab
class NamespacedSessionStore
delegate :[], :[]=, to: :store
- def initialize(key)
+ def initialize(key, session = Session.current)
@key = key
+ @session = session
end
def initiated?
- !Session.current.nil?
+ !session.nil?
end
def store
- return unless Session.current
+ return unless session
- Session.current[@key] ||= {}
- Session.current[@key]
+ session[@key] ||= {}
+ session[@key]
end
+
+ private
+
+ attr_reader :session
end
end