middleware

package
v0.0.0-...-5365f31 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: Apache-2.0 Imports: 14 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"}

	// PocketRequestTokenContextKey is the context key for Pocket Request Token.
	PocketRequestTokenContextKey = &ContextKey{"PocketRequestToken"}
)

Functions

This section is empty.

Types

type ContextKey

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

ContextKey represents a context key.

func (ContextKey) String

func (c ContextKey) String() string

type Middleware

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

Middleware handles different middleware handlers.

func New

func New(cfg *config.Config, store *storage.Storage, router *mux.Router) *Middleware

New returns a new middleware.

func (*Middleware) AppSession

func (m *Middleware) AppSession(next http.Handler) http.Handler

AppSession handles application session middleware.

func (*Middleware) BasicAuth

func (m *Middleware) BasicAuth(next http.Handler) http.Handler

BasicAuth handles HTTP basic authentication.

func (*Middleware) CommonHeaders

func (m *Middleware) CommonHeaders(next http.Handler) http.Handler

CommonHeaders sends common HTTP headers.

func (*Middleware) FeverAuth

func (m *Middleware) FeverAuth(next http.Handler) http.Handler

FeverAuth handles Fever API authentication.

func (*Middleware) HeaderConfig

func (m *Middleware) HeaderConfig(next http.Handler) http.Handler

HeaderConfig changes config values according to HTTP headers.

func (*Middleware) Logging

func (m *Middleware) Logging(next http.Handler) http.Handler

Logging logs the HTTP request.

func (*Middleware) UserSession

func (m *Middleware) UserSession(next http.Handler) http.Handler

UserSession handles the user session middleware.

Jump to

Keyboard shortcuts

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