Skip to content

Commit

Permalink
[backport 3.4]: server/auth: enable tokenProvider if recoved store en…
Browse files Browse the repository at this point in the history
…ables auth

this is a manual backport of etcd-io#13172
  • Loading branch information
cfz authored and tjungblu committed Sep 8, 2022
1 parent 4ebab56 commit fc976c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions auth/simple_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions auth/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit fc976c7

Please sign in to comment.