Documentation ¶
Overview ¶
Package middlewares provides common middleware handlers.
Index ¶
- func CSRFMiddleware(useHTTPS bool, salt string) func(http.Handler) http.Handler
- func MustBeMember(next http.Handler) http.Handler
- func MustLogin(next http.Handler) http.Handler
- func MustLoginApi(next http.Handler) http.Handler
- func MustLoginApiStream(next http.Handler) http.Handler
- func SetAccessTokens(next http.Handler) http.Handler
- func SetAddr(addr string) func(http.Handler) http.Handler
- func SetClusters(next http.Handler) http.Handler
- func SetCookieStore(cookieStore *sessions.CookieStore) func(http.Handler) http.Handler
- func SetDBs(dbConfig *config.DBConfig) func(http.Handler) http.Handler
- func SetLogger(loggerType string, logger *logrus.Logger) func(http.Handler) http.Handler
- func SetMailers(mailers map[string]*mailer.Mailer) func(http.Handler) http.Handler
- func SetMessageBus(bus *messagebus.MessageBus) func(http.Handler) http.Handler
- func SetVIPAddr(vipAddr string) func(http.Handler) http.Handler
- func SetVIPProtocol(vipProtocol string) func(http.Handler) http.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CSRFMiddleware ¶
CSRFMiddleware is a constructor that creates github.com/gorilla/csrf.CSRF struct
func MustLoginApi ¶
MustLoginApi is a middleware that checks /api login.
func MustLoginApiStream ¶
MustLoginApiStream is a middleware that checks /api/.../stream login.
func SetAccessTokens ¶
SetAccessTokens sets clusters data in context based on logged in user ID.
func SetClusters ¶
SetClusters sets clusters data in context based on logged in user ID.
func SetCookieStore ¶
SetCookieStore passes cookie storage to every request handler
func SetMailers ¶
SetMailers passes all mailers to every request handler
func SetMessageBus ¶
func SetMessageBus(bus *messagebus.MessageBus) func(http.Handler) http.Handler
SetMessageBus passes a message bus to every request handler
func SetVIPAddr ¶
SetVIPAddr passes VIP host and port to every request handler
Types ¶
This section is empty.