Merge pull request #13172 from cfz/fix-auth-store-recover

server/auth: enable tokenProvider if recoved store enables auth
This commit is contained in:
Hitoshi Mitake 2021-07-11 21:27:15 +09:00 committed by GitHub
commit 97f2831801
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -156,6 +156,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

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