Document that `BearerToken.ToV2` method return `nil`
when called on `nil`. Write corresponding unit tests.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Remove usage of deprecated of `container.ID` and `token.SessionToken` code
elements. Replace using of custom message generators with the ones provided
by packages. Replace string comparison with `Equal` method call.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
There is a need to add session token to `eacl.Table` structure. To do this,
we need to replace `token.SessionToken` type to another package since `eacl`
package imports `token` one (potential cross-import).
Create `pkg/session` package and replace session token implementation to it.
Related API in `container` package is deprecated from now.
Additionally implement test generator of random session tokens.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
With new neofs-api changes, token issuer will not be stored
in ownerID field of bearer token. We can identify owner by
public key that has been used in signature.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
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>
In some cases SDK Client provided with signed and prepared
session token. In this case we don't need to change verb
or sign it.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>