Documentation
¶
Index ¶
- Variables
- func Auth(authenticated bool) gin.HandlerFunc
- func CheckDuplicate(name string) (check bool)
- func HashPassword(password string) (hash []byte, err error)
- func IsValidName(name string) bool
- func Protect() gin.HandlerFunc
- type Authenticator
- type User
- func (u *User) ComparePassword(password string) bool
- func (u *User) CreateToken() (newtoken string, err error)
- func (u *User) FromName(name string) (err error)
- func (u *User) IsAuthorized(ib uint) bool
- func (u *User) IsValid() bool
- func (u *User) Password() (err error)
- func (u *User) SetAuthenticated()
- func (u *User) SetId(uid uint)
Constants ¶
This section is empty.
Variables ¶
View Source
var Secret string
holds the hmac secret, is set from main
Functions ¶
func Auth ¶
func Auth(authenticated bool) gin.HandlerFunc
checks for session cookie and handles permissions
func CheckDuplicate ¶
check for duplicate name before registering
func HashPassword ¶
hash a given password
func Protect ¶
func Protect() gin.HandlerFunc
Protect will check to see if a user has the correct permissions
Types ¶
type Authenticator ¶
type User ¶
type User struct {
Id uint
Name string
IsAuthenticated bool
// contains filtered or unexported fields
}
user struct
func (*User) ComparePassword ¶
compare password to
func (*User) CreateToken ¶
Creates a JWT token with our claims
Click to show internal directories.
Click to hide internal directories.