auth

package
v0.0.0-...-db88faa Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const RiderKey contextKey = "RiderID"

Variables

View Source
var UserKey contextKey = "UserID"

Functions

func Auth

func Auth(handlerFunc http.HandlerFunc, userStore models.UserRepo) http.HandlerFunc

func CheckPassword

func CheckPassword(hashedPassword string, password []byte) bool

func CreateJWT

func CreateJWT(secret []byte, userId int) (string, error)

func Forbidden

func Forbidden(w http.ResponseWriter)

func GetRiderIDFromContext

func GetRiderIDFromContext(ctx context.Context) int

func GetUserIDFromContext

func GetUserIDFromContext(ctx context.Context) int

func HashPassword

func HashPassword(password string) (string, error)

func RiderAuth

func RiderAuth(handlerFunc http.HandlerFunc, riderStore models.RiderRepository) http.HandlerFunc

func UserAuth

func UserAuth(handlerFunc http.HandlerFunc, riderStore models.RiderRepository) http.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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