gitlab-org--gitlab-foss/config/initializers/warden.rb

22 lines
694 B
Ruby
Raw Normal View History

Rails.application.configure do |config|
Warden::Manager.after_set_user(scope: :user) do |user, auth, opts|
Gitlab::Auth::UniqueIpsLimiter.limit_user!(user)
end
Warden::Manager.before_failure(scope: :user) do |env, opts|
Gitlab::Auth::BlockedUserTracker.log_if_user_blocked(env)
end
2018-05-02 04:08:16 -04:00
Warden::Manager.after_authentication(scope: :user) do |user, auth, opts|
2018-05-02 04:08:16 -04:00
ActiveSession.cleanup(user)
end
Warden::Manager.after_set_user(scope: :user, only: :fetch) do |user, auth, opts|
2018-05-02 04:08:16 -04:00
ActiveSession.set(user, auth.request)
end
Warden::Manager.before_logout(scope: :user) do |user, auth, opts|
2018-05-02 04:08:16 -04:00
ActiveSession.destroy(user || auth.user, auth.request.session.id)
end
end