token

package
v0.0.0-...-b3ea26e Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingHeader = errors.New("The length of the `Authorization` header is zero")
)

Functions

func JwtSign

func JwtSign(c Context, secret string, exp uint) (tokenString string, err error)

JwtSign signs the context with the specified secret.

Types

type Context

type Context struct {
	ID  uint64
	Use uint
}

Context is the context of the JSON web token.

func Parse

func Parse(tokenString string, secret string) (*Context, error)

Parse validates the token with the specified secret, and returns the context if the token was valid.

func ParseRequest

func ParseRequest(c *gin.Context) (*Context, error)

ParseRequest gets the token from the header and pass it to the Parse function to parses the token.

Jump to

Keyboard shortcuts

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