This commit is contained in:
2026-01-05 15:59:13 +08:00
parent 909790a423
commit a361140629
+12 -2
View File
@@ -82,10 +82,20 @@ func AuthorizeHandler(w http.ResponseWriter, r *http.Request) {
// Return result
if result.Allowed {
log.Printf("✓ [Handler] Authorization ALLOWED - Returning 200 OK to client")
helper.RespondWithJSON(w, http.StatusOK, result)
// Return response matching AuthorizationResponse model for client compatibility
response := map[string]interface{}{
"allowed": result.Allowed,
"reason": result.Message,
}
helper.RespondWithJSON(w, http.StatusOK, response)
} else {
log.Printf("✗ [Handler] Authorization DENIED - Returning 403 Forbidden to client (reason: %s)", result.Message)
helper.RespondWithJSON(w, http.StatusForbidden, result)
// Return response matching AuthorizationResponse model for client compatibility
response := map[string]interface{}{
"allowed": result.Allowed,
"reason": result.Message,
}
helper.RespondWithJSON(w, http.StatusForbidden, response)
}
}