[backport 3.4]: server/auth: enable tokenProvider if recoved store enables auth

this is a manual backport of #13172
This commit is contained in:
cfz 2021-07-11 21:29:04 +08:00
parent c50b7260cc
commit 23e79dbf19
No known key found for this signature in database
GPG Key ID: 557D9FD4346B1312
2 changed files with 8 additions and 0 deletions

View File

@ -159,6 +159,11 @@ func (t *tokenSimple) invalidateUser(username string) {
}
func (t *tokenSimple) enable() {
t.simpleTokensMu.Lock()
defer t.simpleTokensMu.Unlock()
if t.simpleTokenKeeper != nil { // already enabled
return
}
if t.simpleTokenTTL <= 0 {
t.simpleTokenTTL = simpleTokenTTLDefault
}

View File

@ -400,6 +400,9 @@ func (as *authStore) Recover(be backend.Backend) {
as.enabledMu.Lock()
as.enabled = enabled
if enabled {
as.tokenProvider.enable()
}
as.enabledMu.Unlock()
}