middleware

package
v0.0.0-...-28ab817 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Authentication
	ErrorUnauthorized    = errors.New("you must be authorized to access this resource")
	ErrorInvalidLogin    = errors.New("the supplied authentication credentials are incorrect")
	ErrorInvalidJWTToken = errors.New("the supplied JWT token was expired or not a valid JWT token")

	ErrorBadPathParameter = errors.New("the supplied path parameter is invalid, did you supply a valid integer?")

	ErrorFailedToCreateRequest     = errors.New("there was a saving your certificate request")
	ErrorFailedToCreateCertificate = errors.New("there was a saving your certificate association")
)

Functions

func AuthorizeJWT

func AuthorizeJWT() gin.HandlerFunc

AuthorizeJWT is a middleware for requiring authentication on protected routes

func ErrorHandler

func ErrorHandler() gin.HandlerFunc

ErrorHandler is middleware that enables you to configure error handling from a centralised place via its fluent API.

func LoggingMiddleware

func LoggingMiddleware(c *gin.Context)

LoggingMiddleware is a middleware for logging every http request that comes through the server

func ParseError

func ParseError(errs ...error) []string

ParseError is a function for extracting proper error messages from gin errors and other types

Types

type ErrorResponse

type ErrorResponse struct {
	Status  int      `json:"status"`
	Errors  []string `json:"errors"`
	Message string   `json:"message"`
}

ErrorResponse is a struct used for openapi documentation generation

Jump to

Keyboard shortcuts

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