backend: remove register and admin user management routes
- Remove /api/auth/register endpoint - Remove /api/admin/users CRUD routes - Simplify router to only keep auth/login and health endpoints
This commit is contained in:
@@ -22,30 +22,13 @@ func Setup(cfg *config.Config) *gin.Engine {
|
|||||||
|
|
||||||
authHandler := handler.NewAuthHandler(userService)
|
authHandler := handler.NewAuthHandler(userService)
|
||||||
healthHandler := handler.NewHealthHandler(db.DB)
|
healthHandler := handler.NewHealthHandler(db.DB)
|
||||||
adminHandler := handler.NewAdminHandler(userService)
|
|
||||||
|
|
||||||
// Public routes
|
// Public routes
|
||||||
r.POST("/api/auth/register", authHandler.Register)
|
|
||||||
r.POST("/api/auth/local-login", authHandler.LocalLogin)
|
r.POST("/api/auth/local-login", authHandler.LocalLogin)
|
||||||
r.POST("/api/auth/lookup-binding", authHandler.LookupBinding)
|
r.POST("/api/auth/lookup-binding", authHandler.LookupBinding)
|
||||||
r.POST("/api/auth/bind-keycloak", authHandler.BindKeycloak)
|
r.POST("/api/auth/bind-keycloak", authHandler.BindKeycloak)
|
||||||
r.POST("/api/auth/init", authHandler.InitAdmin)
|
r.POST("/api/auth/init", authHandler.InitAdmin)
|
||||||
r.GET("/api/health", healthHandler.Check)
|
r.GET("/api/health", healthHandler.Check)
|
||||||
|
|
||||||
// Protected routes
|
|
||||||
api := r.Group("/api")
|
|
||||||
api.Use(middleware.AuthProxy())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Admin routes
|
|
||||||
admin := api.Group("/admin")
|
|
||||||
admin.Use(middleware.RequireRole("admin"))
|
|
||||||
{
|
|
||||||
admin.GET("/users", adminHandler.ListUsers)
|
|
||||||
admin.POST("/users", adminHandler.CreateUser)
|
|
||||||
admin.DELETE("/users/:id", adminHandler.DeleteUser)
|
|
||||||
}
|
|
||||||
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user