feat: make auth token staleness and duration configurable (#777)

* feat: make auth token time to live and staleness configurable

* docs: add configuration docs for auth token TTL and staleness

Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
This commit is contained in:
Jeff MalnickandJeff Mitchell authored and GitHub committed 2020-11-16 10:39:18 -08:00
1 parent a7fca44809
commit 11c7c8dbe8
7 files changed
+190 -63

No files matched your search

+3 -1
View File
@@ -112,7 +112,9 @@ func New(conf *Config) (*Controller, error) {
return static.NewRepository(dbase, dbase, c.kms)
}
c.AuthTokenRepoFn = func() (*authtoken.Repository, error) {
return authtoken.NewRepository(dbase, dbase, c.kms)
return authtoken.NewRepository(dbase, dbase, c.kms,
authtoken.WithTokenTimeToLiveDuration(c.conf.RawConfig.Controller.AuthTokenTimeToLiveDuration),
authtoken.WithTokenTimeToStaleDuration(c.conf.RawConfig.Controller.AuthTokenTimeToStaleDuration))
}
c.ServersRepoFn = func() (*servers.Repository, error) {
return servers.NewRepository(dbase, dbase, c.kms)