backport of commit f3a4c01ba9e05850e255406f5bf4bc7f052c3985 (#22140)

Co-authored-by: akshya96 <87045294+akshya96@users.noreply.github.com>
This commit is contained in:
hc-github-team-secure-vault-core 2023-07-31 17:54:29 -04:00 committed by GitHub
parent 3fb1a15a4f
commit 0624fb4113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

3
changelog/22137.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
core: Remove "expiration manager is nil on tokenstore" error log for unauth requests on DR secondary as they do not have expiration manager.
```

View File

@ -1691,8 +1691,14 @@ func (ts *TokenStore) lookupInternal(ctx context.Context, id string, salted, tai
// If we are still restoring the expiration manager, we want to ensure the
// token is not expired
if ts.expiration == nil {
return nil, errors.New("expiration manager is nil on tokenstore")
switch ts.core.IsDRSecondary() {
case true: // Bail if on DR secondary as expiration manager is nil
return nil, nil
default:
return nil, errors.New("expiration manager is nil on tokenstore")
}
}
le, err := ts.expiration.FetchLeaseTimesByToken(ctx, entry)
if err != nil {
return nil, fmt.Errorf("failed to fetch lease times: %w", err)