2017-02-21 21:17:23 +00:00
|
|
|
Rails.application.configure do |config|
|
2018-05-07 08:13:27 +00:00
|
|
|
Warden::Manager.after_set_user(scope: :user) do |user, auth, opts|
|
2017-02-21 21:17:23 +00:00
|
|
|
Gitlab::Auth::UniqueIpsLimiter.limit_user!(user)
|
|
|
|
end
|
2018-01-15 05:10:48 +00:00
|
|
|
|
2018-05-07 08:13:27 +00:00
|
|
|
Warden::Manager.before_failure(scope: :user) do |env, opts|
|
2018-01-15 05:10:48 +00:00
|
|
|
Gitlab::Auth::BlockedUserTracker.log_if_user_blocked(env)
|
2018-07-17 12:50:04 +00:00
|
|
|
|
|
|
|
Gitlab::Auth::Activity.new(opts).user_authentication_failed!
|
2018-01-15 05:10:48 +00:00
|
|
|
end
|
2018-05-02 08:08:16 +00:00
|
|
|
|
2018-05-07 08:13:27 +00:00
|
|
|
Warden::Manager.after_authentication(scope: :user) do |user, auth, opts|
|
2018-05-02 08:08:16 +00:00
|
|
|
ActiveSession.cleanup(user)
|
2018-07-17 12:50:04 +00:00
|
|
|
|
|
|
|
Gitlab::Auth::Activity.new(opts).user_authenticated!
|
2018-05-02 08:08:16 +00:00
|
|
|
end
|
|
|
|
|
2018-05-07 08:13:27 +00:00
|
|
|
Warden::Manager.after_set_user(scope: :user, only: :fetch) do |user, auth, opts|
|
2018-05-02 08:08:16 +00:00
|
|
|
ActiveSession.set(user, auth.request)
|
2018-07-17 12:50:04 +00:00
|
|
|
|
|
|
|
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!
|
2018-05-02 08:08:16 +00:00
|
|
|
end
|
|
|
|
|
2018-05-07 08:13:27 +00:00
|
|
|
Warden::Manager.before_logout(scope: :user) do |user, auth, opts|
|
2018-05-02 08:08:16 +00:00
|
|
|
ActiveSession.destroy(user || auth.user, auth.request.session.id)
|
2018-07-17 12:50:04 +00:00
|
|
|
|
|
|
|
Gitlab::Auth::Activity.new(opts).user_logout!
|
2018-05-02 08:08:16 +00:00
|
|
|
end
|
2017-02-21 21:17:23 +00:00
|
|
|
end
|