Allow bearer auth on Active Storage downloads

This commit is contained in:
Rob Zolkos
2026-04-08 14:37:24 -04:00
parent dd67f4171d
commit 5e154a767f
2 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -57,7 +57,7 @@ module Authentication
def authenticate_by_bearer_token
if request.authorization.to_s.include?("Bearer")
if request.format.json?
if bearer_token_authenticatable_request?
authenticate_or_request_with_http_token do |token|
if identity = Identity.find_by_permissable_access_token(token, method: request.method)
Current.identity = identity
@@ -69,6 +69,10 @@ module Authentication
end
end
def bearer_token_authenticatable_request?
request.format.json?
end
def request_authentication
if Current.account.present?
session[:return_to_after_authenticating] = request.url