Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsProxiedHTTPS ¶
IsProxiedHTTPS returns true if the original request is using https protocol or false otherwise
func IsUsingSecureConnection ¶
IsUsingSecureConnection returns true if the request is using secure connection or false otherwise
Types ¶
type AuthMiddleware ¶
type AuthMiddleware struct {
Authenticator auth.Authenticator
}
AuthMiddleware provides a generic authentication middleware On failure, a 401 HTTP response is returned. On success, the wrapped middleware is called.
func (*AuthMiddleware) MiddlewareFunc ¶
func (mw *AuthMiddleware) MiddlewareFunc(handler rest.HandlerFunc) rest.HandlerFunc
MiddlewareFunc returns a go-json-rest HTTP Handler function, wrapping calls to the provided HandlerFunc
type CheckRequest ¶
type CheckRequest struct { // Defines a function that, given a request, determines if the request is secure or should be redirected. // Criteria may include, for example, scheme, X-Forward* headers, URL paths, etc. If unset, a default // criteria is applied, checking the request's scheme and TLS configuration IsSecure func(r *rest.Request) bool // When developing, various options can cause unwanted effects (e.g., usually testing happens on localhost with // http, not https, etc.). The following flag can set to true in a development environment to disable checks // and redirection. Default is false (i.e., it is enabled) Disabled bool }
CheckRequest defines the request validation configuration used by RequireHTTPS middleware
type ContextMiddleware ¶ added in v0.4.1
type ContextMiddleware struct{}
ContextMiddleware initializes a context and puts it in the request's env map
func (*ContextMiddleware) MiddlewareFunc ¶ added in v0.4.1
func (mw *ContextMiddleware) MiddlewareFunc(h rest.HandlerFunc) rest.HandlerFunc
MiddlewareFunc makes ContextMiddleware implement the Middleware interface.
type LoggingMiddleware ¶
type LoggingMiddleware struct{}
LoggingMiddleware logs information about the request
func (*LoggingMiddleware) MiddlewareFunc ¶
func (mw *LoggingMiddleware) MiddlewareFunc(h rest.HandlerFunc) rest.HandlerFunc
MiddlewareFunc logs information about the request after it completes
type RequestIDMiddleware ¶
type RequestIDMiddleware struct{}
RequestIDMiddleware appends a request ID header to incoming request for log tracing across services
func (*RequestIDMiddleware) MiddlewareFunc ¶
func (mw *RequestIDMiddleware) MiddlewareFunc(h rest.HandlerFunc) rest.HandlerFunc
MiddlewareFunc makes RequestIDMiddleware implement the Middleware interface.
type RequireHTTPS ¶
type RequireHTTPS struct {
// contains filtered or unexported fields
}
RequireHTTPS provide HTTP middleware to ensure requests are received over secure communication. By default, all requests using HTTP are redirected to the corresponding HTTPS URL.
func NewRequireHTTPS ¶
func NewRequireHTTPS(checkConfig CheckRequest) *RequireHTTPS
NewRequireHTTPS creates a new middleware with the given checks configured
func (*RequireHTTPS) MiddlewareFunc ¶
func (secure *RequireHTTPS) MiddlewareFunc(handler rest.HandlerFunc) rest.HandlerFunc
MiddlewareFunc returns a go-json-rest HTTP Handler function, wrapping calls to the provided HandlerFunc
type SetupHandler ¶
type SetupHandler struct {
// contains filtered or unexported fields
}
SetupHandler structure for filtering REST calls during setup of microservice
func NewSetupHandler ¶
func NewSetupHandler() *SetupHandler
NewSetupHandler creates a new SetupHandler
func (*SetupHandler) ServeHTTP ¶
func (h *SetupHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serve http or return 503 while setup is still in progress
func (*SetupHandler) SetHandler ¶
func (h *SetupHandler) SetHandler(handler http.Handler)
SetHandler creates handler