authentication

package
v0.0.0-...-b489084 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2018 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PublicKey = []byte("secret")

PublicKey set secret public key

Functions

func Auth

func Auth(next http.Handler) http.Handler

Auth checks if user is authenticated

func CheckToken

func CheckToken(jwtToken string) (*jwt.Token, error)

CheckToken checks if token is valid else returns error

func GenerateToken

func GenerateToken(user user.User) (string, error)

GenerateToken generates JWT token en returns it

Types

type MyCustomClaims

type MyCustomClaims struct {
	ID uint
	jwt.MapClaims
}

MyCustomClaims jwt claims with id

Jump to

Keyboard shortcuts

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