[#179] sdk/client: Ease bearer token sanity check

Now owner ID field is not required to be set. According to
latest neofs-api, this field set if token was issued for
specific owner ID. If this field is not set, then any user
can use this token while it is correctly signed and has valid
lifetime.

Lifetime is also can be omitted since node interpret empty
lifetime as a lifetime with zero values.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-10-21 18:10:49 +03:00 committed by Alex Vanin
parent c8f46f7d97
commit e023b6e51e

View file

@ -95,12 +95,8 @@ func sanityCheck(b *BearerToken) error {
return errors.New("bearer token is not set") return errors.New("bearer token is not set")
case b.token.GetBody() == nil: case b.token.GetBody() == nil:
return errors.New("bearer token body is not set") return errors.New("bearer token body is not set")
case b.token.GetBody().GetLifetime() == nil:
return errors.New("bearer token lifetime is not set")
case b.token.GetBody().GetEACL() == nil: case b.token.GetBody().GetEACL() == nil:
return errors.New("bearer token EACL table is not set") return errors.New("bearer token EACL table is not set")
case b.token.GetBody().GetOwnerID() == nil:
return errors.New("bearer token owner is not set")
} }
// consider checking EACL sanity there, lifetime correctness, etc. // consider checking EACL sanity there, lifetime correctness, etc.