Documentation ¶
Index ¶
- Constants
- Variables
- func ComparePasswords(plainPassword string, hashedPassword string) bool
- func GenerateOrLoadKeys() error
- func GenerateToken(userID int64, role Role) (string, time.Time, error)
- func HashAndSaltPassword(password string) (string, error)
- func IsStrongPassword(password string) error
- func IsValidRole(role int) bool
- type JSONToken
- type Role
Constants ¶
View Source
const ( DefaultAdminUser = "admin" DefaultAdminPassword = "admin" )
Default admin credentials
Variables ¶
View Source
var PasswordRequirementsMsg = fmt.Sprintf(
"password must have between %d and %d characters of which at least "+
"1 uppercase letter, 1 digit and 1 special character",
minPasswordLen,
maxPasswordLen,
)
PasswordRequirementsMsg message used to inform the user about password strength requirements
View Source
var ValidRolesMsg = fmt.Sprintf( "valid roles: %d = %s, %d = %s", RoleAdmin, RoleAdmin, RoleAuditor, RoleAuditor, )
ValidRolesMsg ...
Functions ¶
func ComparePasswords ¶
ComparePasswords ...
func GenerateToken ¶
GenerateToken ...
func HashAndSaltPassword ¶
HashAndSaltPassword ...
func IsStrongPassword ¶
IsStrongPassword checks if the provided password meets the strength requirements
Types ¶
Click to show internal directories.
Click to hide internal directories.