Documentation ¶
Index ¶
- func GetTokenFromCtx(ctx context.Context) (string, error)
- func InjectContextWithMockToken(ctx context.Context, token string, serviceName string) context.Context
- func IsAuthenticated(ctx context.Context) bool
- func RandomErrorMiddleware(next http.Handler) http.Handler
- func RequestTime(next http.Handler) http.Handler
- func VersionMiddleware(next http.Handler) http.Handler
- type AuthnMW
- type CorsMw
- type LoggingMiddleware
- type PrometheusMiddleware
- type RandomDelayMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTokenFromCtx ¶
GetTokenFromCtx extracts the token from the context
func InjectContextWithMockToken ¶
func InjectContextWithMockToken(ctx context.Context, token string, serviceName string) context.Context
InjectContextWithMockToken injects a token into the context. Useful for testing
func IsAuthenticated ¶
IsAuthenticated returns wether or not the user is authenticated. REQUIRES Middleware to have run.
Types ¶
type AuthnMW ¶
type AuthnMW struct {
// contains filtered or unexported fields
}
func NewAuthnMiddleware ¶
NewAuthnMiddleware returns a new instance of the authentication middleware
func (*AuthnMW) AuthenticationMiddleware ¶
func (mw *AuthnMW) AuthenticationMiddleware(next http.HandlerFunc) http.HandlerFunc
AuthenticationMiddleware wraps the authentication middleware around an http call
type CorsMw ¶
type CorsMw struct {
// contains filtered or unexported fields
}
func NewCorsMiddleware ¶
NewCorsMiddleware returns a new instance of the cors middleware
type LoggingMiddleware ¶
type LoggingMiddleware struct {
// contains filtered or unexported fields
}
func NewLoggingMiddleware ¶
func NewLoggingMiddleware(logger *zap.Logger) *LoggingMiddleware
type PrometheusMiddleware ¶
type PrometheusMiddleware struct { Histogram *prometheus.HistogramVec Counter *prometheus.CounterVec }
func NewPrometheusMiddleware ¶
func NewPrometheusMiddleware() *PrometheusMiddleware
func (*PrometheusMiddleware) Handler ¶
func (p *PrometheusMiddleware) Handler(next http.Handler) http.Handler
Metrics godoc @Summary Prometheus metrics @Description returns HTTP requests duration and Go runtime metrics @Tags Kubernetes @Produce plain @Router /metrics [get] @Success 200 {string} string "OK"
type RandomDelayMiddleware ¶
type RandomDelayMiddleware struct {
// contains filtered or unexported fields
}
func NewRandomDelayMiddleware ¶
func NewRandomDelayMiddleware(minDelay, maxDelay int, delayUnit string) *RandomDelayMiddleware
Click to show internal directories.
Click to hide internal directories.