diff --git a/app/controllers/jwt_controller.rb b/app/controllers/jwt_controller.rb
index cee3b6c43e7139449b6daa8e1e1ee58ca38ae31a..c05a55633b5bca59d9005dad1cfd3d0d497aa2ab 100644
--- a/app/controllers/jwt_controller.rb
+++ b/app/controllers/jwt_controller.rb
@@ -45,7 +45,7 @@ class JwtController < ApplicationController
     # TODO: this is a copy and paste from grack_auth,
     # it should be refactored in the future
 
-    user = Gitlab::Auth.new.find(login, password)
+    user = Gitlab::Auth.find_in_gitlab_or_ldap(login, password)
 
     # If the user authenticated successfully, we reset the auth failure count
     # from Rack::Attack for that IP. A client may attempt to authenticate
diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb
index 492ffb138a3824412eecb12515a103f8907cb096..9e09d2e118d68f28e23e933656d9a2fe9047e029 100644
--- a/lib/gitlab/backend/grack_auth.rb
+++ b/lib/gitlab/backend/grack_auth.rb
@@ -95,7 +95,7 @@ module Grack
     end
 
     def authenticate_user(login, password)
-      user = Gitlab::Auth.new.find_in_gitlab_or_ldap(login, password)
+      user = Gitlab::Auth.find_in_gitlab_or_ldap(login, password)
 
       unless user
         user = oauth_access_token_check(login, password)