middleware

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessLog

func AccessLog() gin.HandlerFunc

AccessLog returns access log middleware

func CreateToken

func CreateToken(user config.User) (string, error)

CreateToken returns token use jwt with custom claims

func Md5Encrypt

func Md5Encrypt(user config.User) string

Md5Encrypt returns secret key use Mk5 encryption with username and password

func Recovery

func Recovery() gin.HandlerFunc

Recovery handles panic when process http request.

Types

type Authentication

type Authentication interface {
	// Validate validates the token
	Validate(next http.Handler) http.Handler
}

func NewAuthentication

func NewAuthentication(user config.User) Authentication

NewAuthentication creates authentication api instance

type CustomClaims

type CustomClaims struct {
	jwt.StandardClaims
	UserName string `json:"username"`
	Password string `json:"password"`
}

CustomClaims represents jwt custom claims param need username and password and some standard claims

Jump to

Keyboard shortcuts

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