middleware

package
v0.0.0-...-1ce522b Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UserIDContextKey is the context key used to store the user ID.
	UserIDContextKey = &ContextKey{"UserID"}

	// UserTimezoneContextKey is the context key used to store the user timezone.
	UserTimezoneContextKey = &ContextKey{"UserTimezone"}

	// IsAdminUserContextKey is the context key used to store the user role.
	IsAdminUserContextKey = &ContextKey{"IsAdminUser"}

	// IsAuthenticatedContextKey is the context key used to store the authentication flag.
	IsAuthenticatedContextKey = &ContextKey{"IsAuthenticated"}

	// UserSessionTokenContextKey is the context key used to store the user session ID.
	UserSessionTokenContextKey = &ContextKey{"UserSessionToken"}

	// UserLanguageContextKey is the context key to store user language.
	UserLanguageContextKey = &ContextKey{"UserLanguageContextKey"}

	// SessionIDContextKey is the context key used to store the session ID.
	SessionIDContextKey = &ContextKey{"SessionID"}

	// CSRFContextKey is the context key used to store CSRF token.
	CSRFContextKey = &ContextKey{"CSRF"}

	// OAuth2StateContextKey is the context key used to store OAuth2 state.
	OAuth2StateContextKey = &ContextKey{"OAuth2State"}

	// FlashMessageContextKey is the context key used to store a flash message.
	FlashMessageContextKey = &ContextKey{"FlashMessage"}

	// FlashErrorMessageContextKey is the context key used to store a flash error message.
	FlashErrorMessageContextKey = &ContextKey{"FlashErrorMessage"}
)

Functions

This section is empty.

Types

type BasicAuthMiddleware

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

BasicAuthMiddleware is the middleware for HTTP Basic authentication.

func NewBasicAuthMiddleware

func NewBasicAuthMiddleware(s *storage.Storage) *BasicAuthMiddleware

NewBasicAuthMiddleware returns a new BasicAuthMiddleware.

func (*BasicAuthMiddleware) Handler

func (b *BasicAuthMiddleware) Handler(next http.Handler) http.Handler

Handler executes the middleware.

type Chain

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

Chain handles a list of middlewares.

func NewChain

func NewChain(middlewares ...Middleware) *Chain

NewChain returns a new Chain.

func (*Chain) Wrap

func (m *Chain) Wrap(h http.Handler) http.Handler

Wrap adds a HTTP handler into the chain.

func (*Chain) WrapFunc

func (m *Chain) WrapFunc(fn http.HandlerFunc) http.Handler

WrapFunc adds a HTTP handler function into the chain.

type ContextKey

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

ContextKey represents a context key.

func (ContextKey) String

func (c ContextKey) String() string

type FeverMiddleware

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

FeverMiddleware is the middleware that handles Fever API.

func NewFeverMiddleware

func NewFeverMiddleware(s *storage.Storage) *FeverMiddleware

NewFeverMiddleware returns a new FeverMiddleware.

func (*FeverMiddleware) Handler

func (f *FeverMiddleware) Handler(next http.Handler) http.Handler

Handler executes the middleware.

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware represents a HTTP middleware.

type SessionMiddleware

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

SessionMiddleware represents a session middleware.

func NewSessionMiddleware

func NewSessionMiddleware(cfg *config.Config, store *storage.Storage) *SessionMiddleware

NewSessionMiddleware returns a new SessionMiddleware.

func (*SessionMiddleware) Handler

func (s *SessionMiddleware) Handler(next http.Handler) http.Handler

Handler execute the middleware.

type UserSessionMiddleware

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

UserSessionMiddleware represents a user session middleware.

func NewUserSessionMiddleware

func NewUserSessionMiddleware(s *storage.Storage, r *mux.Router) *UserSessionMiddleware

NewUserSessionMiddleware returns a new UserSessionMiddleware.

func (*UserSessionMiddleware) Handler

func (s *UserSessionMiddleware) Handler(next http.Handler) http.Handler

Handler execute the middleware.

Jump to

Keyboard shortcuts

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