Documentation ¶
Index ¶
- Constants
- func Authorize(headers http.Header, secret string) (string, string, error)
- func CheckPasswordHash(password, hash string) bool
- func HashPassword(password string) (string, error)
- func MakeToken(domain, username, secret string, nowUTC time.Time, expiresIn time.Duration) (string, error)
- func ValidatePassword(password string) bool
- func ValidateToken(tokenString, secret string, nowUTC time.Time) (string, string, error)
- type Claims
Constants ¶
View Source
const ( // MinPassLength is the minimum length allowable for passwords MinPassLength = 8 // MaxPassLength is the maxiumum length allowable for passwords MaxPassLength = 50 // MinUsernameLength is the minimum length allowable for usernames MinUsernameLength = 3 // MaxUsernameLength is the maxiumum length allowable for usernames MaxUsernameLength = 15 // MinPasswordLength is the minimum length allowable for passwords MinPasswordLength = 8 )
Variables ¶
This section is empty.
Functions ¶
func Authorize ¶
Authorize takes the headers and returns the username of the user if the token is valid
func CheckPasswordHash ¶
CheckPasswordHash checks a password hash
func HashPassword ¶
HashPassword hashes a password securely
func MakeToken ¶
func MakeToken(domain, username, secret string, nowUTC time.Time, expiresIn time.Duration) (string, error)
MakeToken makes a new jwt token for a user
func ValidatePassword ¶
ValidatePassword returns true if string is a valid password format At least one upper case English letter At least one lower case English letter At least one digit At least one special character Minimum eight in length
Types ¶
Click to show internal directories.
Click to hide internal directories.