1
0
mirror of https://github.com/volatiletech/authboss.git synced 2025-02-13 13:58:38 +02:00

Doc fixes and ensure proper default config

This commit is contained in:
Aaron L 2018-03-09 14:46:33 -08:00
parent ee4b2658d5
commit d752b6bb98
2 changed files with 11 additions and 10 deletions

View File

@ -146,19 +146,23 @@ type Config struct {
// Defaults sets the configuration's default values.
func (c *Config) Defaults() {
c.Paths.Mount = "/auth"
c.Paths.RootURL = "http://localhost:8080"
c.Paths.AuthLoginOK = "/"
c.Paths.ConfirmOK = "/"
c.Paths.ConfirmNotOK = "/"
c.Paths.LockNotOK = "/"
c.Paths.LogoutOK = "/"
c.Paths.OAuth2LoginOK = "/"
c.Paths.OAuth2LoginNotOK = "/"
c.Paths.RecoverOK = "/"
c.Paths.RegisterOK = "/"
c.Paths.RootURL = "http://localhost:8080"
c.Modules.BCryptCost = bcrypt.DefaultCost
c.Modules.ExpireAfter = 60 * time.Minute
c.Modules.ExpireAfter = time.Hour
c.Modules.LockAfter = 3
c.Modules.LockWindow = 5 * time.Minute
c.Modules.LockDuration = 5 * time.Hour
c.Modules.LockDuration = 12 * time.Hour
c.Modules.LogoutMethod = "DELETE"
c.Modules.RecoverTokenDuration = time.Duration(24) * time.Hour
c.Modules.RecoverLoginAfterRecovery = false
c.Modules.RecoverTokenDuration = 24 * time.Hour
}

View File

@ -154,12 +154,9 @@ func (l *Lock) Unlock(ctx context.Context, key string) error {
return l.Authboss.Config.Storage.Server.Save(ctx, lu)
}
// Middleware ensures that a user is confirmed, or else it will intercept the request
// and send them to the confirm page, this will load the user if he's not been loaded
// yet from the session.
//
// Panics if the user was not able to be loaded in order to allow a panic handler to show
// a nice error page, also panics if it failed to redirect for whatever reason.
// Middleware ensures that a user is not locked, or else it will intercept the request
// and send them to the configured LockNotOK page, this will load the user if he's not been loaded
// yet from the session. And panics if it cannot load the user.
func Middleware(ab *authboss.Authboss) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {