initial commit

This commit is contained in:
Giovanni Rezcjikov
2026-03-08 14:54:29 +03:00
commit f4e4fb21e3
75 changed files with 7407 additions and 0 deletions
@@ -0,0 +1,40 @@
package handlers
import (
"net/http"
"github.com/dusiburg/kotosoft-id/internal/services"
"github.com/gin-gonic/gin"
)
type ConsentHandler struct {
svc *services.Service
}
func NewConsentHandler(svc *services.Service) *ConsentHandler {
return &ConsentHandler{svc: svc}
}
func (h *ConsentHandler) GetUserConsents(c *gin.Context) {
userID := mustUserID(c)
consents, err := h.svc.GetUserConsents(c.Request.Context(), userID)
if err != nil {
c.Error(err)
return
}
c.JSON(http.StatusOK, consents)
}
func (h *ConsentHandler) RevokeAppAccess(c *gin.Context) {
userID := mustUserID(c)
clientID := c.Param("clientId")
if err := h.svc.RevokeConsent(c.Request.Context(), userID, clientID); err != nil {
c.Error(err)
return
}
c.Status(http.StatusNoContent)
}