Files
Authorization/handlers/authorize.go
T
2025-12-04 10:55:25 +08:00

27 lines
528 B
Go

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
}
}