Skip to content

Commit

Permalink
Merge pull request #13205 from cfz/cherry-pick-#13172
Browse files Browse the repository at this point in the history
[backport 3.5]: server/auth: enable tokenProvider if recoved store enables auth
  • Loading branch information
ptabor authored May 6, 2022
2 parents 8453b10 + cceb25d commit b57881a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/auth/simple_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions server/auth/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,9 @@ func (as *authStore) Recover(be backend.Backend) {

as.enabledMu.Lock()
as.enabled = enabled
if enabled {
as.tokenProvider.enable()
}
as.enabledMu.Unlock()
}

Expand Down

0 comments on commit b57881a

Please sign in to comment.