middleware

package
v0.0.0-...-9834278 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	TokenExpiredCode int32 = 599

	MOD_NAME = "orcas"
)

Variables

View Source
var (
	ErrTokenExpired   = errors.New("token expired")
	ErrTokenMalformed = errors.New("not a token")
	ErrTokenInvalid   = errors.New("token invalid")
)
View Source
var ORCAS_SECRET = os.Getenv("ORCAS_SECRET")

Functions

func CORS

func CORS() gin.HandlerFunc

func GenerateToken

func GenerateToken(user string, uid int64, role uint32) (string, int64, error)

func GetToken

func GetToken(c *gin.Context) (token string)

func GetUID

func GetUID(c *gin.Context) int64

func JWT

func JWT() gin.HandlerFunc

func Metrics

func Metrics() gin.HandlerFunc

func RequestCount

func RequestCount(method, path string, code int)

func RequestTime

func RequestTime(method, path string, tm float64)

Types

type Claims

type Claims struct {
	User string `json:"u"`
	Role uint32 `json:"r"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(token string) (*Claims, error)

Jump to

Keyboard shortcuts

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