Documentation
¶
Index ¶
- func Authenticator(c *gin.Context) (claims jwt.MapClaims, err error)
- func ComparePasswords(hashedPwd string, plainPwd []byte) bool
- func GenerateHash(password string) string
- func GenerateToken(c *gin.Context, id string, write, delete bool) (t string, rt string, tExp int64, err error)
- func GenerateUniqueCode(max int) (string, error)
- func HashAndSalt(pwd []byte) string
- func HashCompare(password, hashedPwd string) bool
- func RefreshAuthenticator(c *gin.Context) (string, error)
- type Refresher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticator ¶
Authenticator function
The authenticator will sends a 401 Unauthorized responses for any unverified tokens and return claims if passed
func ComparePasswords ¶
ComparePasswords function to compare password login and exists data
func GenerateHash ¶
GenerateHash to generate hash from plain password
func GenerateToken ¶
func GenerateToken(c *gin.Context, id string, write, delete bool) (t string, rt string, tExp int64, err error)
GenerateToken function
Generate JWT token by user uuid, and set user can use write or delete action
func GenerateUniqueCode ¶
GenerateUniqueCode to generate a unique string with 6 letters
func HashAndSalt ¶
HashAndSalt to create hash password with salt and return hash string
func HashCompare ¶
HashCompare to compare your password with your stored hash password
Types ¶
Click to show internal directories.
Click to hide internal directories.