mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-06 07:54:22 +00:00
Update session and cookie managers
This commit is contained in:
@@ -48,7 +48,7 @@ func setupRouter(o Options) *chi.Mux {
|
||||
}
|
||||
|
||||
// Initialize auth middleware and handler
|
||||
authMiddleware := auth.NewMiddleware(o.JWTManager)
|
||||
authMiddleware := auth.NewMiddleware(o.JWTManager, o.SessionManager, o.CookieService)
|
||||
handler := &handlers.Handler{
|
||||
DB: o.Database,
|
||||
Storage: o.Storage,
|
||||
@@ -72,8 +72,8 @@ func setupRouter(o Options) *chi.Mux {
|
||||
|
||||
// Public routes (no authentication required)
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Post("/auth/login", handler.Login(o.SessionService, o.CookieService))
|
||||
r.Post("/auth/refresh", handler.RefreshToken(o.SessionService, o.CookieService))
|
||||
r.Post("/auth/login", handler.Login(o.SessionManager, o.CookieService))
|
||||
r.Post("/auth/refresh", handler.RefreshToken(o.SessionManager, o.CookieService))
|
||||
})
|
||||
|
||||
// Protected routes (authentication required)
|
||||
@@ -82,7 +82,7 @@ func setupRouter(o Options) *chi.Mux {
|
||||
r.Use(context.WithUserContextMiddleware)
|
||||
|
||||
// Auth routes
|
||||
r.Post("/auth/logout", handler.Logout(o.SessionService, o.CookieService))
|
||||
r.Post("/auth/logout", handler.Logout(o.SessionManager, o.CookieService))
|
||||
r.Get("/auth/me", handler.GetCurrentUser())
|
||||
|
||||
// User profile routes
|
||||
|
||||
Reference in New Issue
Block a user