Documentation ¶
Index ¶
- Constants
- Variables
- func AllowRegistration() bool
- func BuildStatement() *persistence.StatementBuilder
- func Disconnected(hub *hub.Hub, delegate core.PostEndpoint, data interface{}) core.Poster
- func ParseRecoveryMessage(name, token string) *core.Message
- func ParseRegistrationMessage(name, token string) *core.Message
- func RawStatement() *persistence.RawStatement
- func ShouldUsePassword() bool
- func ShouldUseTOTP() bool
- type Configuration
- type CookieJar
- type LoginData
- type RegisterData
- type Reset
Constants ¶
const (
// PS is the postscript which may optionally be added to a message
PS = `
P.S. your account will be automatically banned if you reply to this email`
)
Variables ¶
var ( // Hub is a reference to the hub object initially passed to the module. It is here so other packages may access it. Hub *hub.Hub // QRsecret returns the string form of of the OTP url which will be turned into a QR code QRsecret = "otpauth://totp/%s (%s)?secret=%s" )
Functions ¶
func AllowRegistration ¶
func AllowRegistration() bool
AllowRegistration analyzes the configuration and returns true registration is open
func BuildStatement ¶
func BuildStatement() *persistence.StatementBuilder
BuildStatement is a shortcut to the persistence method
func Disconnected ¶
Disconnected takes in a delegate post endpoint and verifies that a user is not logged in before running the delegate
func ParseRecoveryMessage ¶
ParseRecoveryMessage prepares a message for when an account needs to be recovered
func ParseRegistrationMessage ¶
ParseRegistrationMessage prepares a message for when an account registration is attempted
func RawStatement ¶
func RawStatement() *persistence.RawStatement
RawStatement is a shortcut to the persistence method
func ShouldUsePassword ¶
func ShouldUsePassword() bool
ShouldUsePassword analyzes the configuration and returns true if a password should be used during authentication
func ShouldUseTOTP ¶
func ShouldUseTOTP() bool
ShouldUseTOTP analyzes the configuration and returns true if TOTP should be used during authentication
Types ¶
type Configuration ¶
type Configuration struct { // Host describes configuration options dealing with the host server Host struct { // Hostname is the hostname of the server which will run sol Hostname string `json:"hostname"` // Cookies is the secret string used to pad the encrypted session strings. Reset it to invalidate all connections Cookies string `json:"cookies"` } `json:"host"` // Sol describes configuration options specific to sol Sol struct { // TOTPMode determines how sol will use TOTP. It can be completely disabled, required, or preferred over passwords TOTPMode string `json:"totpMode" values:"disabled,required,prefer"` // AppendPS determines whether the PS will be appended to messages Sol makes to send to users AppendPS bool `json:"appendPS" optional:"true"` // DelayConfirmation will enable users to complete registration without first validating their email address DelayConfirmation bool `json:"delayConfirmation" optional:"true"` // AutoLogin will automatically log new users in when they register AutoLogin bool `json:"autoLogin" optional:"true"` // RestrictRegistration will make it so that no one is able to register if set to true RestrictRegistration bool `json:"restrictRegistration" optional:"true"` } `json:"sol"` // Sql describes the connection information for the main SQL server SQL struct { // Host is the hostname or IP of the SQL server Host string `json:"host"` // Port is the port to be used to connect to the SQL server Port int `json:"port"` // Password is the password which is required to connect to the SQL server, this setting is option for if no password // is required Password string `json:"password" optional:"true"` // Database is the database which should be connected to Database string `json:"database"` // Username is the username required to connect to the database Username string `json:"username"` // Sslmode describes which postgres SQL Mode should be used when the database is connected to Sslmode string `json:"sslmode" values:"disable,allow,prefer,require,verify-ca,verify-full"` } `json:"sql"` }
Configuration is the model of various configuration options
var Config Configuration
Config stores all of the configuration information for each package to be able to read
type CookieJar ¶
type CookieJar struct {
// contains filtered or unexported fields
}
CookieJar holds all of the cookies
func GetCookieJar ¶
func GetCookieJar() *CookieJar
GetCookieJar is a singleton constructor for a CookieJar
func (*CookieJar) GetReceipt ¶
GetReceipt returns the receipt from a session with a given name
func (*CookieJar) SetReceipt ¶
SetReceipt sets a receipt to a session
type LoginData ¶
type LoginData struct { Username string `json:"username"` Password string `json:"password"` OTP string `json:"totp"` }
LoginData is a model for the request made when someone attempts to login
type RegisterData ¶
type RegisterData struct { Username string `json:"username"` Password string `json:"password"` Confirm string `json:"confirm"` Email string `json:"email"` Registration string `json:"registration"` }
RegisterData is a model for the request made when someone attempts to register ass a user