Documentation
¶
Overview ¶
hash.go
Index ¶
- func CheckPasswordHash(hash, password string) bool
- func EncMD5(password string) string
- func EncNoEncrypt(password string) string
- func GetCurrentUserRoles(request *http.Request) []string
- func GetCurrentUsername(request *http.Request) string
- func GetDataReturnedByAuthQuery(request *http.Request) interface{}
- func GetSession(key string, request *http.Request) (interface{}, bool)
- func GetSessionId(request *http.Request) (id string)
- func HasRole(role string, request *http.Request) bool
- func HashPassword(password string) string
- func LoginHandler() http.Handler
- func LoginRequired(next http.Handler) http.Handler
- func RemoveSession(key string, request *http.Request) bool
- func RolesRequired(next http.Handler, roles ...string) http.Handler
- func SetClientSession(username string, userId int, response http.ResponseWriter, ...)
- func SetSession(key string, value interface{}, request *http.Request)
- type ComparePasswordFunction
- type Config
- func (config *Config) AuthenticateBySqlQuery(db *sql.DB, authenticateQuery string, rolesQuery string) *Config
- func (config *Config) GetDBType() string
- func (config *Config) SetBycryptCost(bycryptCost int) *Config
- func (config *Config) SetComparePasswordFunction(ComparePasswordFunc ComparePasswordFunction) *Config
- func (config *Config) SetLoginPage(loginPage string) *Config
- func (config *Config) SetLoginPath(loginPath string) *Config
- func (config *Config) SetPasswordColumnName(passwordColumnName string) *Config
- func (config *Config) SetPasswordEncryption(EncryptFunc EncryptFunction) *Config
- func (config *Config) SetSessionTimeout(sessionTimeout int) *Config
- func (config *Config) SetUserIdColumnName(userIdColumnName string) *Config
- func (config *Config) SetUserTableColumns(tableColumns []string) *Config
- func (config *Config) SetUserTableName(userTableName string) *Config
- func (config *Config) SetUsernameColumnName(usernameColumnName string) *Config
- type DataBaseInterface
- type EncryptFunction
- type SqlDataBase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
func EncNoEncrypt ¶
func GetCurrentUserRoles ¶
func GetCurrentUsername ¶
func GetSessionId ¶
func HashPassword ¶
func LoginHandler ¶
func SetClientSession ¶
func SetSession ¶
Types ¶
type ComparePasswordFunction ¶
type Config ¶
type Config struct {
LoginPage string
SessionTimeout int
LoginPath string
SqlDataBaseModel SqlDataBase
EncryptFunction EncryptFunction
ComparePasswordFunction ComparePasswordFunction
UserTableColumns []string
UserTableName string
PasswordColumnName string
UsernameColumnName string
UserIdColumnName string
BycryptCost int
}
func (*Config) AuthenticateBySqlQuery ¶
func (*Config) SetBycryptCost ¶
func (*Config) SetComparePasswordFunction ¶
func (config *Config) SetComparePasswordFunction(ComparePasswordFunc ComparePasswordFunction) *Config
func (*Config) SetLoginPage ¶
func (*Config) SetLoginPath ¶
func (*Config) SetPasswordColumnName ¶
func (*Config) SetPasswordEncryption ¶
func (config *Config) SetPasswordEncryption(EncryptFunc EncryptFunction) *Config
func (*Config) SetSessionTimeout ¶
func (*Config) SetUserIdColumnName ¶
func (*Config) SetUserTableColumns ¶
func (*Config) SetUserTableName ¶
func (*Config) SetUsernameColumnName ¶
type DataBaseInterface ¶
type EncryptFunction ¶
type SqlDataBase ¶
func (*SqlDataBase) AuthenticateUser ¶
func (db *SqlDataBase) AuthenticateUser(username string) (bool, map[string]interface{})
func (*SqlDataBase) RetriveRoles ¶
func (db *SqlDataBase) RetriveRoles(username string) (bool, []string)
Click to show internal directories.
Click to hide internal directories.