middleware

package
v0.0.0-...-a17a3e0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2017 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthAdmin

func AuthAdmin(h httprouter.Handle, db *bolt.DB) httprouter.Handle

func AuthUser

func AuthUser(h httprouter.Handle, db *bolt.DB, ctrs ...Contexter) httprouter.Handle

func AuthWSUser

func AuthWSUser(h httprouter.Handle, db *bolt.DB, ctrs ...Contexter) httprouter.Handle

func CtxGetRefreshToken

func CtxGetRefreshToken(r *http.Request) auth.Token

func CtxGetToken

func CtxGetToken(r *http.Request) auth.Token

func CtxGetUserID

func CtxGetUserID(r *http.Request) string

func CtxSetRefreshToken

func CtxSetRefreshToken(r *http.Request, ctx *auth.Context) *http.Request

func CtxSetToken

func CtxSetToken(r *http.Request, ctx *auth.Context) *http.Request

func CtxSetUserID

func CtxSetUserID(r *http.Request, ctx *auth.Context) *http.Request

func GetToken

func GetToken(kind auth.TokenType, from string) ([]byte, error)

func GetWSToken

func GetWSToken(protocols string, kind auth.TokenType) ([]byte, error)

GetWSToken looks for an Authorization token of the given kind in the comma-separated list of websocket subprotocols. It expects the token as an unpadded base64url-encoded string, prepended by '{kind}+'.

Types

type Contexter

type Contexter func(*http.Request, *auth.Context) *http.Request

func ByFields

func ByFields(fields ...auth.CtxField) Contexter
type Header string
const (
	AuthHeader    Header = "Authorization"
	RefreshHeader Header = "X-Auth-Refresh"

	WSProtocolsHeader Header = "Sec-WebSocket-Protocol"
)

Jump to

Keyboard shortcuts

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