source session secret from config file
This commit is contained in:
parent
fad4fc64e6
commit
c9edd1a018
2 changed files with 6 additions and 2 deletions
|
@ -23,8 +23,12 @@ type session struct {
|
|||
}
|
||||
|
||||
func New(s *settings.Session) Session {
|
||||
secret := securecookie.GenerateRandomKey(32)
|
||||
// TODO (bradrydzewski) hook up the Session.Expires
|
||||
secret := s.Secret
|
||||
expire := time.Hour * 72
|
||||
if len(secret) == 0 {
|
||||
securecookie.GenerateRandomKey(32)
|
||||
}
|
||||
return &session{
|
||||
secret: secret,
|
||||
expire: expire,
|
||||
|
|
|
@ -73,7 +73,7 @@ type Server struct {
|
|||
// used to generate, validate and expire authentication
|
||||
// sessions.
|
||||
type Session struct {
|
||||
Secret string `toml:"secret"`
|
||||
Secret []byte `toml:"secret"`
|
||||
Expires int64 `toml:"expires"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue