jwt

package
v0.0.0-...-30cbc32 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logout

func Logout(res http.ResponseWriter, req *http.Request)

deletes the cookie

func SetToken

func SetToken(res http.ResponseWriter, req *http.Request, username string, usertype string)

create a JWT and put in the clients cookie

func Setup

func Setup(config *viper.Viper)

func Validate

func Validate(usertype string, redirectURI string, page http.HandlerFunc) http.HandlerFunc

middleware to protect private pages

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	Usertype string `json:"usertype"`
	jwt.StandardClaims
}

JWT schema of the data it will store

Jump to

Keyboard shortcuts

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