Documentation ¶
Index ¶
- Constants
- func CompareHashAndPassword(password, hashedPassword string) bool
- func GenerateJwtToken(jwtSecret string, expires time.Duration, user *models.User) (string, error)
- func GeneratePasswordHash(password string) (string, error)
- func IsRAdmin(r *http.Request) bool
- func IsRAuthed(r *http.Request) bool
- func IsRProposer(r *http.Request) bool
- func IsTokenValid(tokenString, jwtSecret string) error
- func User(r *http.Request) *models.User
- func VerifyToken(tokenString, jwtSecret string) (*jwt.Token, error)
- type ContextType
Constants ¶
View Source
const (
UserKey = ContextType("user")
)
Variables ¶
This section is empty.
Functions ¶
func CompareHashAndPassword ¶
func GenerateJwtToken ¶
func GeneratePasswordHash ¶
func IsRProposer ¶
IsRProposer returns true if the user creating the request is a proposer
func IsTokenValid ¶
IsTokenValid returns nil if the jwt token is valid and an error otherwise.
func VerifyToken ¶
Types ¶
type ContextType ¶
type ContextType string
Click to show internal directories.
Click to hide internal directories.