Inline now anemic helper methods

This commit is contained in:
David Heinemeier Hansson
2025-12-02 12:25:10 +01:00
committed by Stanko K.R.
parent 3329008dd8
commit 467843fe22
+4 -10
View File
@@ -56,8 +56,10 @@ module Authentication
end
def authenticate_by_bearer_token
if request_authorized_by_bearer_token?
if access_token = Identity::AccessToken.find_by(token: authorization_bearer_token)
scheme, bearer_token = request.authorization.to_s.split(" ", 2)
if scheme == "Bearer" && bearer_token.present?
if access_token = Identity::AccessToken.find_by(token: bearer_token)
Current.identity = access_token.identity
else
head :unauthorized
@@ -65,14 +67,6 @@ module Authentication
end
end
def request_authorized_by_bearer_token?
request.authorization.to_s.starts_with? "Bearer"
end
def authorization_bearer_token
request.authorization.to_s.split(" ", 2).second
end
def request_authentication
if Current.account.present?
session[:return_to_after_authenticating] = request.url