From 70189ffc4df0b4ebf2b674cd3dfef4dfbcc9487b Mon Sep 17 00:00:00 2001 From: James Kwon <96548424+hongil0316@users.noreply.github.com> Date: Fri, 14 Jun 2024 20:13:57 -0400 Subject: [PATCH] Bypass authorization (#36) * Bypass authorization for non-write operations for non-logged in users * Disable authorization middleware & jwt wrapper middleware --- server/server.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/server.go b/server/server.go index bd7ad46..812e6bf 100644 --- a/server/server.go +++ b/server/server.go @@ -93,9 +93,10 @@ func (s *Server) Start() error { // Attach implementation of generated oapi strict server. impl := implementation.NewStrictServerImplementation(s.Client, s.Config, storageService, slackService) - middlewares := []generated.StrictMiddlewareFunc{ - drip_middleware.AuthorizationMiddleware(s.Client), - } + var middlewares []generated.StrictMiddlewareFunc + //middlewares := []generated.StrictMiddlewareFunc{ + // drip_middleware.AuthorizationMiddleware(s.Client), + //} wrapped := generated.NewStrictHandler(impl, middlewares) generated.RegisterHandlers(e, wrapped) @@ -107,9 +108,10 @@ func (s *Server) Start() error { // Global Middlewares e.Use(drip_middleware.MetricsMiddleware(mon, s.Config)) - e.Use( - drip_middleware.JWTWrapperMiddleware(s.Client, s.Config.JWTSecret, - drip_middleware.FirebaseMiddleware(s.Client))) + //e.Use( + // drip_middleware.JWTWrapperMiddleware(s.Client, s.Config.JWTSecret, + // drip_middleware.FirebaseMiddleware(s.Client))) + e.Use(drip_middleware.FirebaseMiddleware(s.Client)) e.Use(drip_middleware.ServiceAccountAuthMiddleware()) e.Use(drip_middleware.ErrorLoggingMiddleware())