auth

package
v0.0.0-...-d831bb0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPassword

func HashPassword(password string) (string, error)

HashPassword attempts to hash the supplied password

func LoginUser

func LoginUser(user *model.User, jwtSecret string) (string, error)

LoginUser generates a signed JWT token

func ValidateTokenAndGetUserID

func ValidateTokenAndGetUserID(t string, jwtSecret string) (hide.ID, error)

func VerifyPassword

func VerifyPassword(user *model.User, password string) bool

VerifyPassword verifies a password against the stored hash

Types

type UserClaim

type UserClaim struct {
	UserID hide.ID `json:"userId"`
	jwt.StandardClaims
}

UserClaim structure

Jump to

Keyboard shortcuts

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