mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
4264e64f9b
This is a regression from v3. With this change session data is encrypted with AES-GCM using a 256-bit key derived from the provided secret. Fixes #652.
27 lines
727 B
Go
27 lines
727 B
Go
package validator
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/authelia/authelia/internal/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.Redis != nil && 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"))
|
|
}
|
|
}
|