summaryrefslogtreecommitdiff
path: root/config/initializers
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-07-17 14:50:04 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-07-17 14:50:04 +0200
commit416076610e7b1674669ad33bae604155f55a3d02 (patch)
tree5ad144007a1e6ca54b344d5a43ab582e676ef7e4 /config/initializers
parent7f0431dd8550ac9d229d1383c03386c1634d015f (diff)
downloadgitlab-ce-416076610e7b1674669ad33bae604155f55a3d02.tar.gz
Implement scaffold of authentication activity metrics
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/warden.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/config/initializers/warden.rb b/config/initializers/warden.rb
index 8cc36820d3c..c75a76a3118 100644
--- a/config/initializers/warden.rb
+++ b/config/initializers/warden.rb
@@ -5,17 +5,29 @@ Rails.application.configure do |config|
Warden::Manager.before_failure(scope: :user) do |env, opts|
Gitlab::Auth::BlockedUserTracker.log_if_user_blocked(env)
+
+ Gitlab::Auth::Activity.new(opts).user_authentication_failed!
end
Warden::Manager.after_authentication(scope: :user) do |user, auth, opts|
ActiveSession.cleanup(user)
+
+ Gitlab::Auth::Activity.new(opts).user_authenticated!
end
Warden::Manager.after_set_user(scope: :user, only: :fetch) do |user, auth, opts|
ActiveSession.set(user, auth.request)
+
+ Gitlab::Auth::Activity.new(opts).user_session_fetched!
+ end
+
+ Warden::Manager.after_set_user(scope: :user, only: :set_user) do |user, auth, opts|
+ Gitlab::Auth::Activity.new(opts).user_set_manually!
end
Warden::Manager.before_logout(scope: :user) do |user, auth, opts|
ActiveSession.destroy(user || auth.user, auth.request.session.id)
+
+ Gitlab::Auth::Activity.new(opts).user_logout!
end
end