[#1229] util: Fix session token expiration check

* Make session token expired at `current_epoch + 1` but
  not at `current_epoch` when it's still valid.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-07-05 11:50:11 +03:00 committed by Evgenii Stratonikov
parent 0c2b6f3dac
commit d90aab5454

View file

@ -67,7 +67,7 @@ func (s *KeyStorage) GetKey(info *SessionInfo) (*ecdsa.PrivateKey, error) {
pToken := s.tokenStore.Get(info.Owner, binID)
if pToken != nil {
if pToken.ExpiredAt() <= s.networkState.CurrentEpoch() {
if pToken.ExpiredAt() < s.networkState.CurrentEpoch() {
return nil, new(apistatus.SessionTokenExpired)
}
return pToken.SessionKey(), nil