Skip to content

Commit 8a571f0

Browse files
committed
Re-added old logic to support using auth server with password-based authentication
1 parent 71cdc94 commit 8a571f0

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/murfey/server/api/auth.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ async def validate_token(
9494
try:
9595
# Validate using auth URL if provided; will error if invalid
9696
if auth_url:
97+
# Extract and forward headers as-is
98+
headers = dict(request.headers)
99+
# Update/add authorization header if authenticating using password
100+
if security_config.auth_type == "password":
101+
headers["authorization"] = f"Bearer {token}"
102+
# Forward the cookie along if authenticating using cookie
97103
cookies = (
98104
{security_config.cookie_key: token}
99105
if security_config.auth_type == "cookie"
@@ -102,7 +108,7 @@ async def validate_token(
102108
async with aiohttp.ClientSession(cookies=cookies) as session:
103109
async with session.get(
104110
f"{auth_url}/validate_token",
105-
headers=request.headers,
111+
headers=headers,
106112
) as response:
107113
success = response.status == 200
108114
validation_outcome = await response.json()

0 commit comments

Comments
 (0)