Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthRequired ¶
func AuthRequired() gin.HandlerFunc
AuthRequired is middleware that validates whether or not the current request has been authenticated by a JWT. If the request is not authenticated, a 401 HTTP code will be returned.
func Authenticate ¶
Authenticate authenticates a user by providing a JWT if the provided email and password match with the information from the database.
func GetUserID ¶
GetUserID gets the user ID of the current request. It will return 0 and an error when something went wrong.
func ParseToken ¶
ParseToken parses the encoded token by verifying if it contains 'Bearer {token}'. The token will be validated as well.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.