fix: call auth hooks before raising error

This commit is contained in:
Revant Nandgaonkar 2023-11-17 12:48:49 +05:30
parent 443d508669
commit fea87d09dc

View file

@ -571,6 +571,7 @@ def validate_auth():
authorization_header = frappe.get_request_header("Authorization", "").split(" ")
if len(authorization_header) == 2:
validate_auth_via_hooks()
validate_oauth(authorization_header)
validate_auth_via_api_keys(authorization_header)
@ -579,8 +580,6 @@ def validate_auth():
if frappe.session.user in ("", "Guest"):
raise frappe.AuthenticationError
validate_auth_via_hooks()
def validate_oauth(authorization_header):
"""
@ -621,7 +620,7 @@ def validate_oauth(authorization_header):
frappe.set_user(frappe.db.get_value("OAuth Bearer Token", token, "user"))
frappe.local.form_dict = form_dict
except AttributeError:
raise frappe.AuthenticationError
pass
def validate_auth_via_api_keys(authorization_header):