feat(api): add /auth/whoami endpoint for identity detection

This commit is contained in:
2025-12-25 14:41:38 +08:00
parent b566eb8058
commit 8e6d86edd7
2 changed files with 221 additions and 0 deletions

View File

@@ -203,6 +203,7 @@ func main() {
masterHandler := api.NewMasterHandler(db, logDB, masterService, syncService, statsService, logPartitioner)
internalHandler := api.NewInternalHandler(db)
featureHandler := api.NewFeatureHandler(rdb)
authHandler := api.NewAuthHandler(db, rdb, adminService, masterService)
modelRegistryService := service.NewModelRegistryService(db, rdb, service.ModelRegistryConfig{
Enabled: cfg.ModelRegistry.Enabled,
RefreshEvery: time.Duration(cfg.ModelRegistry.RefreshSeconds) * time.Second,
@@ -356,6 +357,12 @@ func main() {
masterGroup.GET("/stats", masterHandler.GetSelfStats)
}
// Auth Routes (public, no middleware - self-validates token)
authGroup := r.Group("/auth")
{
authGroup.GET("/whoami", authHandler.Whoami)
}
// Public/General Routes (if any)
r.POST("/logs", handler.IngestLog)