From 0d8366f475c78475bcc4e215cb6631e24f85a9e6 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 20 Jan 2023 12:57:53 +0300 Subject: [PATCH] [#2207] object/acl: Return status error for expired session token Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 1 + pkg/services/object/acl/v2/service.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac236d9ad..6ea8b3df0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Changelog for FrostFS Node ### Fixed - Big object removal with non-local parts (#1978) - Disable pilorama when moving to degraded mode (#2197) +- Correct status error for expired session token (#2207) ### Removed ### Updated diff --git a/pkg/services/object/acl/v2/service.go b/pkg/services/object/acl/v2/service.go index a6ca20908..5432bcf95 100644 --- a/pkg/services/object/acl/v2/service.go +++ b/pkg/services/object/acl/v2/service.go @@ -10,6 +10,7 @@ import ( "github.com/TrueCloudLab/frostfs-node/pkg/core/netmap" "github.com/TrueCloudLab/frostfs-node/pkg/services/object" "github.com/TrueCloudLab/frostfs-node/pkg/util/logger" + apistatus "github.com/TrueCloudLab/frostfs-sdk-go/client/status" "github.com/TrueCloudLab/frostfs-sdk-go/container/acl" cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id" oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id" @@ -573,6 +574,9 @@ func (b Service) findRequestInfo(req MetaWithToken, idCnr cid.ID, op acl.Op) (in if err != nil { return info, errors.New("can't fetch current epoch") } + if req.token.ExpiredAt(currentEpoch) { + return info, apistatus.SessionTokenExpired{} + } if req.token.InvalidAt(currentEpoch) { return info, fmt.Errorf("%s: token is invalid at %d epoch)", invalidRequestMessage, currentEpoch)