auth

package
v0.0.0-...-4d4b9d2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2017 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ConfigKey key = iota
)

RSA keys

Variables

View Source
var SignKey []byte

SignKey key is use to sign jwt with rsa

Functions

func Authenticate

func Authenticate(next http.Handler) http.Handler

Authenticate middleware to check if a request it Authenticated

func CompareHash

func CompareHash(passwordhash string, password string) (err error)

CompareHash compares users provided password with the hash

func GenerateJWTTokken

func GenerateJWTTokken(username string, uuid string) (token string, err error)

GenerateJWTTokken generates a jwt web token with username as claim, and the user uuid TODO add more claims , roles claims

func HashPassword

func HashPassword(password string) (hash []byte, err error)

HashPassword creates a hash of a password

Types

type JwtClaims

type JwtClaims struct {
	Name string `json:"name"`
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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