middleware

package
v0.0.0-...-b0db392 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package middleware contains middleware which is called before the actual http handler and provides filtering or context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticatedFilter

func AuthenticatedFilter(loginURL string) func(next xhandler.HandlerC) xhandler.HandlerC

AuthenticatedFilter filters logged in users. Users with an invalid session are redirected to the loginURL.

func JSONWrapper

func JSONWrapper() func(next xhandler.HandlerC) xhandler.HandlerC

JSONWrapper sets the content-type of the response to json.

func UnauthenticatedFilter

func UnauthenticatedFilter(loggedInURL string) func(next xhandler.HandlerC) xhandler.HandlerC

UnauthenticatedFilter filters not-logged in users. Users with a valid session are redirected to the loggedInURL.

func UserContext

func UserContext() func(next xhandler.HandlerC) xhandler.HandlerC

UserContext adds the users session data to the handler context.

Types

type Session

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

Session middleware manages sessions

func (*Session) Enable

func (m *Session) Enable(name string) func(next xhandler.HandlerC) xhandler.HandlerC

Enable enables session management. It creates a new session if none exists. Session is stored to the context as `session`.

func (*Session) Init

func (m *Session) Init(hashKey, blockKey []byte)

Init creates a new session store

Jump to

Keyboard shortcuts

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