handlers

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnableCors bool
	CorsOrigin string
)

Functions

func NewWebsocket added in v0.11.0

func NewWebsocket(handler WebSocketHandler, w http.ResponseWriter, r *http.Request)

func ReadFromRequest added in v0.11.0

func ReadFromRequest(request *http.Request, v interface{}) error

func WriteErrorResponse

func WriteErrorResponse(response http.ResponseWriter, message string, code int)

func WriteResponse

func WriteResponse(response http.ResponseWriter, bytes []byte)

func WriteResponseWithContentType added in v1.3.4

func WriteResponseWithContentType(response http.ResponseWriter, bytes []byte, contentType string)

Types

type AdminHandler

type AdminHandler interface {
	RegisterRoutes(*bone.Mux, *AuthHandler)
}

type AllUsersResponse

type AllUsersResponse struct {
	Users []backends.User `json:"users"`
}

type AuthHandler

type AuthHandler struct {
	AB                 backends.Authentication
	SecretKey          []byte
	JWTExpirationDelta int
	Enabled            bool
}

func (*AuthHandler) GetAllUsersHandler

func (a *AuthHandler) GetAllUsersHandler(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

GetAllUsersHandler - returns a list of all users

func (*AuthHandler) Login

func (a *AuthHandler) Login(w http.ResponseWriter, r *http.Request)

func (*AuthHandler) Logout

func (a *AuthHandler) Logout(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

func (*AuthHandler) OptionsLogin added in v0.12.0

func (a *AuthHandler) OptionsLogin(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

func (*AuthHandler) RefreshToken

func (a *AuthHandler) RefreshToken(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

func (*AuthHandler) RegisterRoutes

func (this *AuthHandler) RegisterRoutes(mux *bone.Mux)

func (*AuthHandler) RequireTokenAuthentication

func (a *AuthHandler) RequireTokenAuthentication(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)

type ErrorView

type ErrorView struct {
	Error string `json:"error"`
}

type HealthHandler added in v0.14.1

type HealthHandler struct{}

func (*HealthHandler) Get added in v0.14.1

func (this *HealthHandler) Get(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)

func (*HealthHandler) RegisterRoutes added in v0.14.1

func (this *HealthHandler) RegisterRoutes(mux *bone.Mux, am *AuthHandler)

type HealthView added in v0.14.1

type HealthView struct {
	Message string `json:"message"`
}

type WebSocketHandler added in v0.11.0

type WebSocketHandler func() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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