summaryrefslogtreecommitdiff
path: root/config/initializers/warden.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-07-31 09:24:19 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-07-31 09:24:19 +0200
commitde8f8cdf068ba4f029539217daccbbf6ccc6c6f6 (patch)
tree139e15ec008e02c2746dfdfef8f9e694075f565d /config/initializers/warden.rb
parent719eeb0f49e4200c345ba555b343a65227a3258e (diff)
downloadgitlab-ce-de8f8cdf068ba4f029539217daccbbf6ccc6c6f6.tar.gz
Improve authentication activity code readability
Diffstat (limited to 'config/initializers/warden.rb')
-rw-r--r--config/initializers/warden.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/config/initializers/warden.rb b/config/initializers/warden.rb
index 3d632232930..d64b659c6d7 100644
--- a/config/initializers/warden.rb
+++ b/config/initializers/warden.rb
@@ -2,16 +2,18 @@ Rails.application.configure do |config|
Warden::Manager.after_set_user(scope: :user) do |user, auth, opts|
Gitlab::Auth::UniqueIpsLimiter.limit_user!(user)
+ activity = Gitlab::Auth::Activity.new(user, opts)
+
case opts[:event]
when :authentication
- Gitlab::Auth::Activity.new(user, opts).user_authenticated!
+ activity.user_authenticated!
when :set_user
- Gitlab::Auth::Activity.new(user, opts).user_authenticated!
- Gitlab::Auth::Activity.new(user, opts).user_session_override!
+ activity.user_authenticated!
+ activity.user_session_override!
when :fetch # rubocop:disable Lint/EmptyWhen
# We ignore session fetch events
else
- Gitlab::Auth::Activity.new(user, opts).user_session_override!
+ activity.user_session_override!
end
end