mid

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// RequestIDKey is the key used to store the request ID in the context.
	RequestIDKey = "request_id"
)

Variables

This section is empty.

Functions

func AuthJwtCookie

func AuthJwtCookie(c *gin.Context)

func GetContext

func GetContext(c *gin.Context) context.Context

func GetUID

func GetUID(c *gin.Context) string

func Logger

func Logger(c *gin.Context)

func NewJwtToken

func NewJwtToken(userID string) (string, error)

func SetJwtHmacSecret

func SetJwtHmacSecret(secret string)

func SetJwtToHeader

func SetJwtToHeader(c *gin.Context, userID string) error

Types

type JwtClaims

type JwtClaims struct {
	UserID string `json:"uid"`
	jwt.RegisteredClaims
}

func ParseJwtToken

func ParseJwtToken(tokenString string) (*JwtClaims, error)

func (*JwtClaims) Valid

func (c *JwtClaims) Valid() error

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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