auth

package
v0.0.0-...-386a0b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package auth implements the authentication in use for gophish.

Index

Constants

View Source
const SSODomain = ".everycloud.com" // ".localhost"
View Source
const SSOMasterLoginURL = "https://www.everycloud.com/bakery/login" // "https://localhost:3333/sso/mock"

Variables

View Source
var ErrBadDomain = errors.New("Incorrect domain name")

ErrBadDomain is thrown when a user provides a malformed domain name

View Source
var ErrBadEmail = errors.New("Incorrect e-mail address")

ErrBadEmail is thrown when a user provides a malformed email address

View Source
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

View Source
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

View Source
var ErrInvalidPassword = errors.New("Invalid Password")

ErrInvalidPassword is thrown when a user provides an incorrect password.

View Source
var ErrPasswordMismatch = errors.New("Passwords must match")

ErrPasswordMismatch is thrown when a user provides passwords that do not match

View Source
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

View Source
var ErrUsernameTaken = errors.New("Username already taken")

ErrUsernameTaken is thrown when a user attempts to register a username that is taken.

Store contains the session information for the request

Functions

func ChangeLogo(r *http.Request) error

func GenerateLimitedAccessKey

func GenerateLimitedAccessKey(id int64, ip, route string) string

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

func IsValidPassword(password string) bool

IsValidPassword tells is the given password conforms to our password policy

func Login

func Login(r *http.Request) (bool, models.User, error)

Login attempts to login the user given a request.

func Register

func Register(r *http.Request) (bool, error)

Register attempts to register the user given a request.

func UpdateSettings

func UpdateSettings(r *http.Request) error

func UpdateSettingsByAdmin

func UpdateSettingsByAdmin(r *http.Request) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL