services/acl: check session token expiration epoch
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
68903c9fd9
commit
ff1912aa2a
1 changed files with 11 additions and 0 deletions
|
@ -417,6 +417,17 @@ func (b Service) findRequestInfo(
|
|||
return info, errors.New("missing owner in container descriptor")
|
||||
}
|
||||
|
||||
if req.token != nil && req.token.Exp() != 0 {
|
||||
currentEpoch, err := b.nm.Epoch()
|
||||
if err != nil {
|
||||
return info, errors.New("can't fetch current epoch")
|
||||
}
|
||||
if req.token.Exp() < currentEpoch {
|
||||
return info, fmt.Errorf("%w: token has expired (current epoch: %d, expired at %d)",
|
||||
ErrMalformedRequest, currentEpoch, req.token.Exp())
|
||||
}
|
||||
}
|
||||
|
||||
// find request role and key
|
||||
res, err := b.c.classify(req, cid, cnr)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue