refactor(server): merge authserver implementation

This commit is contained in:
mac
2026-07-15 14:05:22 +08:00
parent 8203beb8cd
commit 6af511ed0b
59 changed files with 176 additions and 497 deletions
+27
View File
@@ -0,0 +1,27 @@
package handler
import (
"net/http"
"github.com/gin-gonic/gin"
)
type UserHandler struct{}
func NewUserHandler() *UserHandler {
return &UserHandler{}
}
func (h *UserHandler) Me(c *gin.Context) {
claims, ok := CurrentClaims(c)
if !ok {
c.JSON(http.StatusUnauthorized, gin.H{"error": "missing current user"})
return
}
c.JSON(http.StatusOK, gin.H{
"id": claims.UserID,
"username": claims.Username,
"email": claims.Email,
"is_admin": claims.IsAdmin,
})
}