1
0
mirror of https://github.com/volatiletech/authboss.git synced 2025-01-08 04:03:53 +02:00
authboss/config.go
Kris Runzer e660edd428 Safety commit
- Add new validation methods
- Cleaned up interactions with validation
- Add required validation
- Add confirm fields to validation
2015-01-25 23:02:43 -08:00

64 lines
1.4 KiB
Go

package authboss
import (
"io"
"io/ioutil"
"net/smtp"
"time"
)
// Config holds all the configuration for both authboss and it's modules.
type Config struct {
// MountPath is the path to mount the router at.
MountPath string
// ViewsPath is the path to overiding view template files.
ViewsPath string
// HostName is self explanitory
HostName string
AuthLogoutRoute string
AuthLoginSuccessRoute string
RecoverInitiateRedirect string
RecoverInitiateSuccessFlash string
Policies []Validator
ConfirmFields []string
ExpireAfter time.Duration
LockAfter int
LockWindow time.Duration
LockDuration time.Duration
EmailFrom string
EmailSubjectPrefix string
SMTPAddress string
SMTPAuth smtp.Auth
Storer Storer
CookieStoreMaker CookieStoreMaker
SessionStoreMaker SessionStoreMaker
LogWriter io.Writer
Callbacks *Callbacks
Mailer Mailer
}
// NewConfig creates a new config full of default values ready to override.
func NewConfig() *Config {
return &Config{
MountPath: "/",
ViewsPath: "/",
AuthLogoutRoute: "/",
AuthLoginSuccessRoute: "/",
RecoverInitiateRedirect: "/login",
RecoverInitiateSuccessFlash: "An email has been sent with further insructions on how to reset your password",
LogWriter: ioutil.Discard,
Callbacks: NewCallbacks(),
Mailer: LogMailer(ioutil.Discard),
}
}