From e9232a0838f351347d93dc491033e4e117a76ddd Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Sun, 23 Feb 2025 16:49:30 -0500 Subject: [PATCH] fix require auth middleware --- internal/server/routes.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/server/routes.go b/internal/server/routes.go index c16f80d..043990c 100644 --- a/internal/server/routes.go +++ b/internal/server/routes.go @@ -8,10 +8,11 @@ import ( func addBaseMiddleware(app *RatchetApp, next http.Handler, requireAuth bool) http.Handler { var h http.Handler + h = next if requireAuth { - h = RequireAuthenticationMiddleware(next, app.sessionManager) + h = RequireAuthenticationMiddleware(h, app.sessionManager) } - h = AuthenticateMiddleware(next, app.sessionManager, app.userService) + h = AuthenticateMiddleware(h, app.sessionManager, app.userService) h = NoSurfMiddleware(h) h = app.sessionManager.LoadAndSave(h) return h