feat: autenticação com cookie de sessão + tela de login Arcade Neon
- Go: middleware RequireAuth protege todas as rotas /api/* - Go: POST /api/login valida APP_USERNAME/APP_PASSWORD e emite cookie HttpOnly 30 dias - Go: GET /api/auth/me e POST /api/logout - Vue: LoginView com design Arcade Neon - Vue: router guard redireciona para /login se não autenticado - Vue: api.ts redireciona para /login em qualquer 401 - docker-compose: APP_USERNAME e APP_PASSWORD como env vars Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"financeiro-carvalho/internal/db"
|
||||
"financeiro-carvalho/internal/handler"
|
||||
authmw "financeiro-carvalho/internal/middleware"
|
||||
"financeiro-carvalho/internal/migration"
|
||||
"financeiro-carvalho/internal/repository"
|
||||
"financeiro-carvalho/internal/service"
|
||||
@@ -78,7 +79,12 @@ func main() {
|
||||
|
||||
r.Get("/health", handler.Health)
|
||||
|
||||
r.Post("/api/login", authmw.LoginHandler)
|
||||
r.Post("/api/logout", authmw.LogoutHandler)
|
||||
r.Get("/api/auth/me", authmw.MeHandler)
|
||||
|
||||
r.Route("/api", func(r chi.Router) {
|
||||
r.Use(authmw.RequireAuth)
|
||||
r.Get("/categories", categoryHandler.List)
|
||||
r.Post("/categories", categoryHandler.Create)
|
||||
r.Put("/categories/{id}", categoryHandler.Update)
|
||||
|
||||
Reference in New Issue
Block a user