middleware

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version string = ""

Version contains version information

Functions

func Auth added in v0.6.1

func Auth() gin.HandlerFunc

Auth is a middleware to check if the user is authorized to access the resource

func CORS

func CORS() gin.HandlerFunc

func GRPCZap

func GRPCZap() grpc.UnaryServerInterceptor

GRPCZap is a request interceptor for logging all gRPC requests using Zap

func GinZap

func GinZap(logger *zap.Logger, cfg config.Config) gin.HandlerFunc

GinZap add a custom middleware from zap

func OnlyAdmin added in v0.6.1

func OnlyAdmin() gin.HandlerFunc

OnlyAdmin check if the user is an administrator

func RecoveryWithZap

func RecoveryWithZap(logger *zap.Logger, stack bool) gin.HandlerFunc

RecoveryWithZap recovery middleware implementation with zap

func RequestIdentifier

func RequestIdentifier() gin.HandlerFunc

RequestIdentifier inject a UUIDv4 in all contexts for better tracking

func SetupI18n

func SetupI18n() gin.HandlerFunc

SetupI18n implements i18n configuration to be used in middleware

func VersionInfo

func VersionInfo() gin.HandlerFunc

VersionInfo add a version header to the request

func Yourself added in v0.6.1

func Yourself() gin.HandlerFunc

Yourself validates if the logged in user is the same as the request

Types

type Session added in v0.6.1

type Session struct {
	SessionID string
	UserID    string
	UserLevel string
	FirstName string
}

Session models the session data

func GetSession added in v0.6.1

func GetSession(ctx *gin.Context) *Session

GetSession gets the session data from the context

Jump to

Keyboard shortcuts

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