middlewares

package
v0.0.0-...-851e7b8 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth() gin.HandlerFunc

Auth is jwt authentication method

func LimitHeaderInfo

func LimitHeaderInfo(perSecond int) gin.HandlerFunc

LimitHeaderInfo is a middleware for api request frequece limitation

func Limiter

func Limiter(perSecond int) gin.HandlerFunc

Limiter will limit IP request frequency

func MatchRoles

func MatchRoles(allowedGroups []int) gin.HandlerFunc

MatchRoles roles for request todo: refuse Api request when user's role dose not match the allowed groups matrix

define a router use Roles usersApis.POST("/formalReg", middlewares.Auth(), middilewares.MatchRoles([]int{roles.Admin, roles.Author}), usersHandlers.FormalRegister())

func TestOnly

func TestOnly() gin.HandlerFunc

TestOnly means available for development environment only

Types

This section is empty.

Jump to

Keyboard shortcuts

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