27 lines
632 B
Go
27 lines
632 B
Go
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)
|
|
}
|