middleware

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package middleware is responsible for the definition/implementation of middleware functionality. This package will also handle maintaining request Context and Session.

Index

Constants

This section is empty.

Variables

View Source
var CSRFExemptPrefixes = []string{
	"/api",
}

Functions

func CSRFExceptions added in v0.2.0

func CSRFExceptions(handler http.Handler) http.HandlerFunc

func GetContext

func GetContext(handler http.Handler) http.HandlerFunc

GetContext wraps each request in a function which fills in the context for a given request. This includes setting the User and Session keys and values as necessary for use in later functions.

func JSONError

func JSONError(w http.ResponseWriter, c int, m string)

JSONError returns an error in JSON format with the given status code and message

func RequireAPIKey

func RequireAPIKey(handler http.Handler) http.HandlerFunc

func RequireLogin

func RequireLogin(handler http.Handler) http.HandlerFunc

RequireLogin is a simple middleware which checks to see if the user is currently logged in. If not, the function returns a 302 redirect to the login page.

Types

This section is empty.

Jump to

Keyboard shortcuts

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