middleware

package
v0.0.0-...-99e5d07 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2021 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTokenFromCtx

func GetTokenFromCtx(ctx context.Context) (string, error)

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

func IsAuthenticated(ctx context.Context) bool

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 NewAuthnMw

func NewAuthnMw(c *core_auth_sdk.Client, log core_logging.ILog, serviceName string) *AuthnMW

NewAuthnMw returns a new instance of the authentication middleware

func (*AuthnMW) AuthenticationMiddleware

func (mw *AuthnMW) AuthenticationMiddleware(next http.Handler) http.Handler

AuthenticationMiddleware wraps the authentication middleware around an http call

type CorsMw

type CorsMw struct {
	// contains filtered or unexported fields
}

func NewCorsMw

func NewCorsMw(origins []string) *CorsMw

NewCorsMw returns a new instance of the cors middleware

func (*CorsMw) CorsMiddleware

func (c *CorsMw) CorsMiddleware(next http.Handler) http.Handler

CorsMiddleware runs the Cors middleware

type LoggingMiddleware

type LoggingMiddleware struct {
}

func NewLoggingMiddleware

func NewLoggingMiddleware() *LoggingMiddleware

NewLoggingMiddleware returns a new instance of the logging middleware

func (*LoggingMiddleware) LoggingMiddleware

func (m *LoggingMiddleware) LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware runs the logging middleware

type PrometheusMiddleware

type PrometheusMiddleware struct {
	Histogram *core_metrics.HistogramVec
	Counter   *core_metrics.CounterVec
}

func NewPrometheusMiddleware

func NewPrometheusMiddleware(h *core_metrics.HistogramVec, c *core_metrics.CounterVec) *PrometheusMiddleware

NewPrometheusMiddleware returns an instance of the middleware object

func (*PrometheusMiddleware) MetricsMiddleware

func (p *PrometheusMiddleware) MetricsMiddleware(next http.Handler) http.Handler

MetricsMiddleware returns HTTP requests duration and Go runtime metrics

type RandomDelayMiddleware

type RandomDelayMiddleware struct {
	// contains filtered or unexported fields
}

func NewRandomDelayMiddleware

func NewRandomDelayMiddleware(minDelay, maxDelay int, delayUnit string) *RandomDelayMiddleware

NewRandomDelayMiddleware returns an instance of the random delay middleware

func (*RandomDelayMiddleware) DelayMiddleware

func (m *RandomDelayMiddleware) DelayMiddleware(next http.Handler) http.Handler

DelayMiddleware runs the random delay middleware

type RandomErrMw

type RandomErrMw struct{}

func NewRandomErrMw

func NewRandomErrMw() *RandomErrMw

NewRandomErrMw returns a new instance of the random errors middleware

func (*RandomErrMw) RandomErrorMiddleware

func (mw *RandomErrMw) RandomErrorMiddleware(next http.Handler) http.Handler

RandomErrorMiddleware runs the random error middleware

type VersionrMw

type VersionrMw struct {
	// contains filtered or unexported fields
}

func NewVersionMw

func NewVersionMw(version string) *VersionrMw

NewVersionMw returns a new instance of the version errors middleware

func (*VersionrMw) VersionMiddleware

func (mw *VersionrMw) VersionMiddleware(next http.Handler) http.Handler

VersionMiddleware runs the version middleware

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL