Documentation ¶
Overview ¶
Package auth implements the authentication in use for gophish.
Index ¶
- Constants
- Variables
- func ChangeLogo(r *http.Request) error
- func GenerateLimitedAccessKey(id int64, ip, route string) string
- func IsValidPassword(password string) bool
- func Login(r *http.Request) (bool, models.User, error)
- func Register(r *http.Request) (bool, error)
- func UpdateSettings(r *http.Request) error
- func UpdateSettingsByAdmin(r *http.Request) error
- type LimitedAccessKey
Constants ¶
const SSODomain = ".everycloud.com" // ".localhost"
const SSOMasterLoginURL = "https://www.everycloud.com/bakery/login" // "https://localhost:3333/sso/mock"
Variables ¶
var ErrBadDomain = errors.New("Incorrect domain name")
ErrBadDomain is thrown when a user provides a malformed domain name
var ErrBadEmail = errors.New("Incorrect e-mail address")
ErrBadEmail is thrown when a user provides a malformed email address
var ErrBadPassword = errors.New("Password must be at least 8 chars long with at least 1 letter, 1 number and 1 special character")
ErrBadPassword is thrown when a user provides passwords that does not conform our password policy
var ErrEmptyPassword = errors.New("Password cannot be blank")
ErrEmptyPassword is thrown when a user provides a blank password to the register or change password functions
var ErrInvalidPassword = errors.New("Invalid Password")
ErrInvalidPassword is thrown when a user provides an incorrect password.
var ErrPasswordMismatch = errors.New("Passwords must match")
ErrPasswordMismatch is thrown when a user provides passwords that do not match
var ErrSyncUserData = errors.New("Could not sync user details with the main server")
ErrSyncUserData is thrown when something is wrong with synchronization of user data
var ErrUsernameTaken = errors.New("Username already taken")
ErrUsernameTaken is thrown when a user attempts to register a username that is taken.
var Store = sessions.NewCookieStore( []byte(securecookie.GenerateRandomKey(64)), []byte(securecookie.GenerateRandomKey(32)))
Store contains the session information for the request
Functions ¶
func ChangeLogo ¶
func GenerateLimitedAccessKey ¶
GenerateLimitedAccessKey generates an encrypted access key limited to the given route prefix and IP. Will return empty string in case of any errors.
func IsValidPassword ¶
IsValidPassword tells is the given password conforms to our password policy
func UpdateSettings ¶
func UpdateSettingsByAdmin ¶
Types ¶
type LimitedAccessKey ¶
type LimitedAccessKey struct { ID int64 `json:"id"` IP string `json:"ip"` Route string `json:"route"` }
LimitedAccessKey holds a combo of user id, ip and route prefix
func ParseLimitedAccessKey ¶
func ParseLimitedAccessKey(key string) (*LimitedAccessKey, error)
ParseLimitedAccessKey decrypts the given limited access key
func (*LimitedAccessKey) IsValidForRequest ¶
func (lak *LimitedAccessKey) IsValidForRequest(r *http.Request) bool
IsValidForRequest tells if this limited access key is valid for the given request