This commit is contained in:
2025-12-04 10:55:25 +08:00
commit 60992c1e44
19 changed files with 1058 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package handlers
import (
"authorization/helper"
"authorization/models"
"authorization/services"
"encoding/json"
"net/http"
)
func AuthorizeHandler(w http.ResponseWriter, r *http.Request) {
var request models.AuthorizationRequest
err := json.NewDecoder(r.Body).Decode(&request)
if err != nil {
helper.RespondWithError(w, http.StatusBadRequest, "Invalid request payload")
return
}
allowed := services.Authorize()
if !allowed {
helper.RespondWithError(w, http.StatusForbidden, "Access denied")
return
}
}