2019-04-24 21:52:08 +00:00
|
|
|
package validator
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
2019-12-24 02:14:52 +00:00
|
|
|
"github.com/authelia/authelia/internal/configuration/schema"
|
2019-04-24 21:52:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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"))
|
|
|
|
}
|
|
|
|
}
|