summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-17 21:09:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-17 21:09:50 +0000
commiteda321fc0b96e44e296341f6288dd7f1a27ba93a (patch)
tree1dba04e1ccc485d078da441ab767e650489af112 /app/controllers
parentf1503ea64b21497db21094355ac574248dc243c4 (diff)
downloadgitlab-ce-eda321fc0b96e44e296341f6288dd7f1a27ba93a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/jwt_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/jwt_controller.rb b/app/controllers/jwt_controller.rb
index 8eebf9fbf6b..d62c0b3cf98 100644
--- a/app/controllers/jwt_controller.rb
+++ b/app/controllers/jwt_controller.rb
@@ -36,6 +36,7 @@ class JwtController < ApplicationController
@authentication_result = Gitlab::Auth.find_for_git_client(login, password, project: nil, ip: request.ip)
if @authentication_result.failed?
+ log_authentication_failed(login, @authentication_result)
render_unauthorized
end
end
@@ -54,6 +55,19 @@ class JwtController < ApplicationController
}, status: :unauthorized
end
+ def log_authentication_failed(login, result)
+ log_info = {
+ message: 'JWT authentication failed',
+ http_user: login,
+ remote_ip: request.ip,
+ auth_service: params[:service],
+ 'auth_result.type': result.type,
+ 'auth_result.actor_type': result.actor&.class
+ }.merge(::Gitlab::ApplicationContext.current)
+
+ Gitlab::AuthLogger.warn(log_info)
+ end
+
def render_unauthorized
render json: {
errors: [