summaryrefslogtreecommitdiff
path: root/app/controllers/concerns/sessionless_authentication.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/concerns/sessionless_authentication.rb')
-rw-r--r--app/controllers/concerns/sessionless_authentication.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/concerns/sessionless_authentication.rb b/app/controllers/concerns/sessionless_authentication.rb
index a9ef33bf3b9..36ba3d686af 100644
--- a/app/controllers/concerns/sessionless_authentication.rb
+++ b/app/controllers/concerns/sessionless_authentication.rb
@@ -7,11 +7,15 @@
module SessionlessAuthentication
# This filter handles personal access tokens, atom requests with rss tokens, and static object tokens
def authenticate_sessionless_user!(request_format)
- user = Gitlab::Auth::RequestAuthenticator.new(request).find_sessionless_user(request_format)
+ user = request_authenticator.find_sessionless_user(request_format)
sessionless_sign_in(user) if user
end
+ def request_authenticator
+ @request_authenticator ||= Gitlab::Auth::RequestAuthenticator.new(request)
+ end
+
def sessionless_user?
current_user && !session.key?('warden.user.user.key')
end