jwt

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ClaimsKey contextKey = "claims"

Variables

This section is empty.

Functions

func Middleware

func Middleware(secret string) func(http.Handler) http.Handler

func RequireAdmin

func RequireAdmin(next http.Handler) http.Handler

func SignToken

func SignToken(accountID, groupID int, nickname, secret string) (string, error)

Types

type Claims

type Claims struct {
	AccountID int    `json:"account_id"`
	GroupID   int    `json:"group_id"`
	Nickname  string `json:"nickname"`
	gojwt.RegisteredClaims
}

func GetClaims

func GetClaims(r *http.Request) *Claims

func ParseToken

func ParseToken(tokenString, secret string) (*Claims, error)

Jump to

Keyboard shortcuts

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