authelia/configuration/validator/session.go
Clement Michaud 828f565290 Bootstrap Go implementation of Authelia.
This is going to be the v4.

Expected improvements:
- More reliable due to static typing.
- Bump of performance.
- Improvement of logging.
- Authelia can be shipped as a single binary.
- Will likely work on ARM architecture.
2019-10-28 23:28:59 +01:00

27 lines
690 B
Go

package validator
import (
"errors"
"github.com/clems4ever/authelia/configuration/schema"
)
// ValidateSession validates and update session configuration.
func ValidateSession(configuration *schema.SessionConfiguration, validator *schema.StructValidator) {
if configuration.Name == "" {
configuration.Name = schema.DefaultSessionConfiguration.Name
}
if configuration.Secret == "" {
validator.Push(errors.New("Set secret of the session object"))
}
if configuration.Expiration == 0 {
configuration.Expiration = schema.DefaultSessionConfiguration.Expiration // 1 hour
}
if configuration.Domain == "" {
validator.Push(errors.New("Set domain of the session object"))
}
}