Documentation
¶
Overview ¶
Package auth : Authentication package
Index ¶
- Constants
- func ComparePasswords(hashed string, plain []byte) bool
- func CreateJWT(secret []byte, userID int) (string, error)
- func GetUserIDFromContext(ctx context.Context) int
- func HashPassword(password string) (string, error)
- func WithJWTAuth(handlerFunc http.HandlerFunc, store types.UserStore) http.HandlerFunc
Constants ¶
View Source
const UserKey contextKey = "userID"
UserKey is the key for the user ID in the context
Variables ¶
This section is empty.
Functions ¶
func ComparePasswords ¶
ComparePasswords compares a hashed password with a plain text password
func GetUserIDFromContext ¶
GetUserIDFromContext gets the user ID from the context
func HashPassword ¶
HashPassword hashes a password
func WithJWTAuth ¶
func WithJWTAuth(handlerFunc http.HandlerFunc, store types.UserStore) http.HandlerFunc
WithJWTAuth adds JWT authentication to a handler
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.