handlers

package
v0.0.0-...-412dc8c Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func API

func API(app interfaces.App, handler APIHandlerFunc) http.HandlerFunc

API Create a handler which is accessible by any user, authenticated or not.

func AdminAPI

func AdminAPI(app interfaces.App, handler APIHandlerFunc) http.HandlerFunc

AdminAPI Create a handler which is accessible only by authenticated admins.

func CORS

func CORS(config interfaces.AppConfig, logger *zap.Logger) func(http.Handler) http.Handler

CORS Returns a http.Handler wrapper function for adding CORS validation to an application.

func CORSAllowedHeaders

func CORSAllowedHeaders() []string

CORSAllowedHeaders Return a list of allowed CORS headers.

func CORSAllowedMethods

func CORSAllowedMethods() []string

CORSAllowedMethods Return a list of allowed CORS methods.

func CORSOriginValidator

func CORSOriginValidator(config interfaces.AppConfig, logger *zap.Logger) func(string) bool

CORSOriginValidator Generates a CORS origin validator function.

func UserAPI

func UserAPI(app interfaces.App, handler APIHandlerFunc) http.HandlerFunc

UserAPI Create a handler which is accessible only by authenticated users and admins.

Types

type APIHandlerFunc

type APIHandlerFunc func(req interfaces.RequestContext) *views.Response

APIHandlerFunc A HTTP handler which conforms to our API framework.

type AuthorizerFunc

type AuthorizerFunc func(req interfaces.RequestContext) bool

func AdminAuthorizer

func AdminAuthorizer() AuthorizerFunc

func AnonAuthorizer

func AnonAuthorizer() AuthorizerFunc

func UserAuthorizer

func UserAuthorizer() AuthorizerFunc

Jump to

Keyboard shortcuts

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