From c2ff5ac1fa78057c010154f905d4256dcae1acca Mon Sep 17 00:00:00 2001 From: mStar aka a person <12024604-mstarongitlab@users.noreply.gitlab.com> Date: Mon, 29 Jan 2024 17:11:26 +0000 Subject: [PATCH] Add placeholder middleware for guardian --- guardian/guardian.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 guardian/guardian.go diff --git a/guardian/guardian.go b/guardian/guardian.go new file mode 100644 index 0000000..6fd6538 --- /dev/null +++ b/guardian/guardian.go @@ -0,0 +1,27 @@ +package guardian + +import ( + "net/http" + + "gitlab.com/mstarongitlab/linstrom/config" + "gitlab.com/mstarongitlab/linstrom/storage" +) + +type GuardianMiddleware struct { + nextHandler http.Handler + config *config.Config + storage *storage.Storage +} + +func NewMiddleware(nextHandler http.Handler, cfg *config.Config, s *storage.Storage) *GuardianMiddleware { + return &GuardianMiddleware{ + nextHandler: nextHandler, + config: cfg, + storage: s, + } +} + +func (gm *GuardianMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) { + // TODO: Add guardian filtering stuff here, see Planka + gm.nextHandler.ServeHTTP(w, r) +}