diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb
index bd129d7216a71d1bf1b3c0f3e0c44792fc87f356..076e2af7d38eb07622c9ae7824a5ae29433ea7cc 100644
--- a/lib/gitlab/auth.rb
+++ b/lib/gitlab/auth.rb
@@ -35,6 +35,27 @@ module Gitlab
         end
       end
 
+      def rate_limit!(ip, success:, login:)
+        rate_limiter = Gitlab::Auth::IpRateLimiter.new(ip)
+        return unless rate_limiter.enabled?
+
+        if success
+          # Repeated login 'failures' are normal behavior for some Git clients so
+          # it is important to reset the ban counter once the client has proven
+          # they are not a 'bad guy'.
+          rate_limiter.reset!
+        else
+          # Register a login failure so that Rack::Attack can block the next
+          # request from this IP if needed.
+          rate_limiter.register_fail!
+
+          if rate_limiter.banned?
+            Rails.logger.info "IP #{ip} failed to login " \
+              "as #{login} but has been temporarily banned from Git auth"
+          end
+        end
+      end
+
       private
 
       def valid_ci_request?(login, password, project)
@@ -61,27 +82,6 @@ module Gitlab
           token && token.accessible? && User.find_by(id: token.resource_owner_id)
         end
       end
-
-      def rate_limit!(ip, success:, login:)
-        rate_limiter = IpRateLimiter.new(ip)
-        return unless rate_limiter.enabled?
-
-        if success
-          # Repeated login 'failures' are normal behavior for some Git clients so
-          # it is important to reset the ban counter once the client has proven
-          # they are not a 'bad guy'.
-          rate_limiter.reset!
-        else
-          # Register a login failure so that Rack::Attack can block the next
-          # request from this IP if needed.
-          rate_limiter.register_fail!(ip, config)
-
-          if rate_limiter.banned?
-            Rails.logger.info "IP #{ip} failed to login " \
-              "as #{login} but has been temporarily banned from Git auth"
-          end
-        end
-      end
     end
   end
 end
diff --git a/lib/gitlab/auth/rate_limiter.rb b/lib/gitlab/auth/ip_rate_limiter.rb
similarity index 100%
rename from lib/gitlab/auth/rate_limiter.rb
rename to lib/gitlab/auth/ip_rate_limiter.rb
diff --git a/spec/requests/jwt_controller_spec.rb b/spec/requests/jwt_controller_spec.rb
index d006ff195cf8a9970c2d5b74f90e896950193901..c995993a8531e15aaad4e84064f060cfcc6ef5e0 100644
--- a/spec/requests/jwt_controller_spec.rb
+++ b/spec/requests/jwt_controller_spec.rb
@@ -44,7 +44,7 @@ describe JwtController do
       let(:user) { create(:user) }
       let(:headers) { { authorization: credentials('user', 'password') } }
 
-      before { expect_any_instance_of(Gitlab::Auth).to receive(:find).with('user', 'password').and_return(user) }
+      before { expect(Gitlab::Auth).to receive(:find_in_gitlab_or_ldap).with('user', 'password').and_return(user) }
 
       subject! { get '/jwt/auth', parameters, headers }