Documentation
¶
Index ¶
- Constants
- func CurrentUser(c *gin.Context) (string, error)
- func CurrentUserRoles(c *gin.Context) ([]string, error)
- func ExtractToken(c *gin.Context) string
- func GenerateToken(username string, roles []string) (string, error)
- func HasRole(context *gin.Context, role string) bool
- func HashPassword(password string) (string, error)
- func JWTMiddleware() gin.HandlerFunc
- func ValidatePassword(hashedPassword, currPassword string) bool
- func ValidateToken(c *gin.Context) error
Constants ¶
View Source
const ( ROLE_ADMIN string = "ADMIN" ROLE_ZONE_ADMIN string = "ZONE_ADMIN" )
Variables ¶
This section is empty.
Functions ¶
func CurrentUser ¶
Extract the current user from the token
func ExtractToken ¶
Extract the JWT Token from the Gin Context
func HashPassword ¶
func JWTMiddleware ¶
func JWTMiddleware() gin.HandlerFunc
func ValidatePassword ¶
func ValidateToken ¶
Validate if the JWT token is valid, is from this issuer, and is signed with the approriate secret Will return an error if anything is off with the token
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.