fix: call auth hooks before validate auth

This commit is contained in:
Revant Nandgaonkar 2023-11-17 14:10:37 +05:30
parent fea87d09dc
commit 1ecb60f1b0
2 changed files with 3 additions and 2 deletions

View file

@ -22,7 +22,7 @@ import frappe.rate_limiter
import frappe.recorder
import frappe.utils.response
from frappe import _
from frappe.auth import SAFE_HTTP_METHODS, UNSAFE_HTTP_METHODS, HTTPRequest, validate_auth
from frappe.auth import SAFE_HTTP_METHODS, UNSAFE_HTTP_METHODS, HTTPRequest, validate_auth, validate_auth_via_hooks
from frappe.middlewares import StaticDataMiddleware
from frappe.utils import CallbackManager, cint, get_site_name
from frappe.utils.data import escape_html
@ -94,6 +94,8 @@ def application(request: Request):
init_request(request)
validate_auth_via_hooks()
validate_auth()
if request.method == "OPTIONS":

View file

@ -571,7 +571,6 @@ 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)