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.
|
|
|
|
MountPath string `json:"mount_path" xml:"mountPath"`
|
|
|
|
// ViewsPath is the path to overiding view template files.
|
|
|
|
ViewsPath string `json:"views_path" xml:"viewsPath"`
|
2015-01-04 20:33:53 +02:00
|
|
|
|
2015-01-24 02:25:12 +02:00
|
|
|
AuthLogoutRoute string `json:"auth_logout_route" xml:"authLogoutRoute"`
|
|
|
|
AuthLoginSuccessRoute string `json:"auth_login_success_route" xml:"authLoginSuccessRoute"`
|
2015-01-04 20:33:53 +02:00
|
|
|
|
2015-01-19 00:24:20 +02:00
|
|
|
ValidateEmail Validator `json:"-" xml:"-"`
|
|
|
|
ValidateUsername Validator `json:"-" xml:"-"`
|
|
|
|
ValidatePassword Validator `json:"-" xml:"-"`
|
2015-01-18 09:37:05 +02:00
|
|
|
|
2015-01-24 02:25:12 +02:00
|
|
|
LockAfter int `json:"lock_after" xml:"lockAfter"`
|
|
|
|
LockWindow time.Duration `json:"lock_window" xml:"lockWindow"`
|
|
|
|
LockDuration time.Duration `json:"lock_duration" xml:"lockDuration"`
|
|
|
|
|
2015-01-26 01:40:57 +02:00
|
|
|
EmailFrom string `json:"email_from" xml:"emailFrom"`
|
|
|
|
EmailSubjectPrefix string `json:"email_subject_prefix" xml:"emailSubjectPrefix"`
|
|
|
|
|
|
|
|
SMTPAddress string `json:"smtp_address" xml:"smtpAddress"`
|
|
|
|
SMTPAuth smtp.Auth `json:"-" xml:"-"`
|
|
|
|
|
2015-01-13 00:02:07 +02:00
|
|
|
Storer Storer `json:"-" xml:"-"`
|
|
|
|
CookieStoreMaker CookieStoreMaker `json:"-" xml:"-"`
|
|
|
|
SessionStoreMaker SessionStoreMaker `json:"-" xml:"-"`
|
|
|
|
LogWriter io.Writer `json:"-" xml:"-"`
|
2015-01-16 00:01:01 +02:00
|
|
|
Callbacks *Callbacks `json:"-" xml:"-"`
|
2015-01-17 07:49:23 +02:00
|
|
|
Mailer Mailer `json:"-" xml:"-"`
|
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-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
|
|
|
}
|