2015-01-03 22:03:57 +02:00
|
|
|
package authboss
|
|
|
|
|
2015-01-05 10:18:41 +02:00
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
"io/ioutil"
|
2015-01-26 01:40:57 +02:00
|
|
|
"net/smtp"
|
2015-01-24 02:25:12 +02:00
|
|
|
"time"
|
2015-01-05 10:18:41 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// Config holds all the configuration for both authboss and it's modules.
|
2015-01-04 20:33:53 +02:00
|
|
|
type Config struct {
|
2015-01-24 02:25:12 +02:00
|
|
|
// MountPath is the path to mount the router at.
|
2015-01-26 08:58:50 +02:00
|
|
|
MountPath string
|
2015-01-24 02:25:12 +02:00
|
|
|
// ViewsPath is the path to overiding view template files.
|
2015-01-26 08:58:50 +02:00
|
|
|
ViewsPath string
|
|
|
|
// HostName is self explanitory
|
|
|
|
HostName string
|
2015-01-04 20:33:53 +02:00
|
|
|
|
2015-01-26 08:58:50 +02:00
|
|
|
AuthLogoutRoute string
|
|
|
|
AuthLoginSuccessRoute string
|
2015-01-04 20:33:53 +02:00
|
|
|
|
2015-01-26 08:58:50 +02:00
|
|
|
RecoverInitiateRedirect string
|
|
|
|
RecoverInitiateSuccessFlash string
|
2015-01-18 09:37:05 +02:00
|
|
|
|
2015-01-26 08:58:50 +02:00
|
|
|
Policies []Validator
|
|
|
|
ConfirmFields []string
|
2015-01-26 04:13:32 +02:00
|
|
|
|
2015-01-26 08:58:50 +02:00
|
|
|
ExpireAfter time.Duration
|
|
|
|
LockAfter int
|
|
|
|
LockWindow time.Duration
|
|
|
|
LockDuration time.Duration
|
2015-01-24 02:25:12 +02:00
|
|
|
|
2015-01-26 08:58:50 +02:00
|
|
|
EmailFrom string
|
|
|
|
EmailSubjectPrefix string
|
2015-01-26 01:40:57 +02:00
|
|
|
|
2015-01-26 08:58:50 +02:00
|
|
|
SMTPAddress string
|
|
|
|
SMTPAuth smtp.Auth
|
2015-01-26 01:40:57 +02:00
|
|
|
|
2015-01-26 08:58:50 +02:00
|
|
|
Storer Storer
|
|
|
|
CookieStoreMaker CookieStoreMaker
|
|
|
|
SessionStoreMaker SessionStoreMaker
|
2015-01-27 12:11:19 +02:00
|
|
|
XSRFMaker XSRF
|
2015-01-26 08:58:50 +02:00
|
|
|
LogWriter io.Writer
|
|
|
|
Callbacks *Callbacks
|
|
|
|
Mailer Mailer
|
2015-01-05 10:18:41 +02:00
|
|
|
}
|
2015-01-04 20:33:53 +02:00
|
|
|
|
2015-01-05 10:18:41 +02:00
|
|
|
// NewConfig creates a new config full of default values ready to override.
|
|
|
|
func NewConfig() *Config {
|
|
|
|
return &Config{
|
2015-01-08 09:45:41 +02:00
|
|
|
MountPath: "/",
|
|
|
|
ViewsPath: "/",
|
2015-01-11 09:12:40 +02:00
|
|
|
|
|
|
|
AuthLogoutRoute: "/",
|
2015-01-19 00:24:20 +02:00
|
|
|
AuthLoginSuccessRoute: "/",
|
|
|
|
|
2015-01-26 08:58:50 +02:00
|
|
|
RecoverInitiateRedirect: "/login",
|
|
|
|
RecoverInitiateSuccessFlash: "An email has been sent with further insructions on how to reset your password",
|
|
|
|
|
2015-01-05 10:18:41 +02:00
|
|
|
LogWriter: ioutil.Discard,
|
2015-01-16 00:01:01 +02:00
|
|
|
Callbacks: NewCallbacks(),
|
2015-01-26 01:40:57 +02:00
|
|
|
Mailer: LogMailer(ioutil.Discard),
|
2015-01-05 10:18:41 +02:00
|
|
|
}
|
2015-01-04 20:33:53 +02:00
|
|
|
}
|