Documentation
¶
Overview ¶
Package auth provides session-based user authentication for Adele applications.
It handles login and logout, "remember me" cookie tokens, retrieval of the currently authenticated user, and bcrypt password hashing, persisting users and remember tokens through the framework's database layer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var InvalidPasswordOrUserError = errors.New("the username or password is incorrect")
View Source
var RememberTokenDeleteError = errors.New("error removing remember token form storage")
View Source
var RememberTokenHashError = errors.New("error hashing remember token")
View Source
var RememberTokenStoreError = errors.New("error adding remember token to storage")
Functions ¶
func HashPassword ¶
hash a plain text password for secure use in the application
Types ¶
type Auth ¶
type Auth struct {
AppName string
DB *database.Database
ErrorLog *log.Logger
Session *scs.SessionManager
}
type RememberToken ¶
type User ¶
type User struct {
ID int `db:"id,omitempty" json:"id"`
FirstName string `db:"first_name" json:"firstName"`
LastName string `db:"last_name" json:"lastName"`
Email string `db:"email" json:"email"`
Active int `db:"user_active" json:"active"`
Password string `db:"password" json:"-"`
CreatedAt time.Time `db:"created_at" json:"createdAt"`
UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
}
Click to show internal directories.
Click to hide internal directories.