session

package
v1.25.1-0...-2fdc35d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyToAllContainers

func ApplyToAllContainers(c *ContainerContext)

ActOnAllContainers is a helper function that conveniently applies ContainerContext to all containers.

Types

type ContainerContext

type ContainerContext session.ContainerSessionContext

ContainerContext represents NeoFS API v2-compatible context of the container session.

It is a wrapper over session.ContainerSessionContext which allows to abstract from details of the message structure.

func ContainerContextFromV2

func ContainerContextFromV2(v *session.ContainerSessionContext) *ContainerContext

ContainerContextFromV2 wraps session.ContainerSessionContext into ContainerContext.

func GetContainerContext

func GetContainerContext(t *Token) *ContainerContext

GetContainerContext is a helper function that casts Token context to ContainerContext.

Returns nil if context is not a ContainerContext.

func NewContainerContext

func NewContainerContext() *ContainerContext

NewContainerContext creates and returns blank ContainerSessionContext.

Defaults:

  • not bound to any operation;
  • applied to all containers.

func (*ContainerContext) ApplyTo

func (x *ContainerContext) ApplyTo(id *cid.ID)

ApplyTo specifies which container the ContainerContext applies to.

If id is nil, ContainerContext is applied to all containers.

func (*ContainerContext) Container

func (x *ContainerContext) Container() *cid.ID

Container returns identifier of the container to which the ContainerContext applies.

Returns nil if ContainerContext is applied to all containers.

func (*ContainerContext) ForDelete

func (x *ContainerContext) ForDelete()

ForDelete binds the ContainerContext to DELETE operation.

func (*ContainerContext) ForPut

func (x *ContainerContext) ForPut()

ForPut binds the ContainerContext to PUT operation.

func (*ContainerContext) ForSetEACL

func (x *ContainerContext) ForSetEACL()

ForSetEACL binds the ContainerContext to SETEACL operation.

func (*ContainerContext) IsForDelete

func (x *ContainerContext) IsForDelete() bool

IsForDelete checks if ContainerContext is bound to DELETE operation.

func (*ContainerContext) IsForPut

func (x *ContainerContext) IsForPut() bool

IsForPut checks if ContainerContext is bound to PUT operation.

func (*ContainerContext) IsForSetEACL

func (x *ContainerContext) IsForSetEACL() bool

IsForSetEACL checks if ContainerContext is bound to SETEACL operation.

func (*ContainerContext) Marshal

func (x *ContainerContext) Marshal(bs ...[]byte) ([]byte, error)

Marshal marshals ContainerContext into a protobuf binary form.

func (*ContainerContext) MarshalJSON

func (x *ContainerContext) MarshalJSON() ([]byte, error)

MarshalJSON encodes ContainerContext to protobuf JSON format.

func (*ContainerContext) ToV2

ToV2 converts ContainerContext to session.ContainerSessionContext message structure.

func (*ContainerContext) Unmarshal

func (x *ContainerContext) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of ContainerContext.

func (*ContainerContext) UnmarshalJSON

func (x *ContainerContext) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes ContainerContext from protobuf JSON format.

type Token

type Token session.SessionToken

Token represents NeoFS API v2-compatible session token.

func NewToken

func NewToken() *Token

NewToken creates and returns blank Token.

Defaults:

  • body: nil;
  • id: nil;
  • ownerId: nil;
  • sessionKey: nil;
  • exp: 0;
  • iat: 0;
  • nbf: 0;

func NewTokenFromV2

func NewTokenFromV2(tV2 *session.SessionToken) *Token

NewTokenFromV2 wraps session.SessionToken message structure into Token.

Nil session.SessionToken converts to nil.

func (*Token) Context

func (t *Token) Context() interface{}

Context returns context of the Token.

Supports same contexts as SetContext.

Returns nil if context is not supported.

func (*Token) Exp

func (t *Token) Exp() uint64

Exp returns epoch number of the token expiration.

func (*Token) ID

func (t *Token) ID() []byte

ID returns Token identifier.

func (*Token) Iat

func (t *Token) Iat() uint64

Iat returns starting epoch number of the token.

func (*Token) Marshal

func (t *Token) Marshal(bs ...[]byte) ([]byte, error)

Marshal marshals Token into a protobuf binary form.

Buffer is allocated when the argument is empty. Otherwise, the first buffer is used.

func (*Token) MarshalJSON

func (t *Token) MarshalJSON() ([]byte, error)

MarshalJSON encodes Token to protobuf JSON format.

func (*Token) Nbf

func (t *Token) Nbf() uint64

Nbf returns starting epoch number of the token.

func (*Token) OwnerID

func (t *Token) OwnerID() *owner.ID

OwnerID returns Token's owner identifier.

func (*Token) SessionKey

func (t *Token) SessionKey() []byte

SessionKey returns public key of the session in a binary format.

func (*Token) SetContext

func (t *Token) SetContext(v interface{})

SetContext sets context of the Token.

Supported contexts:

  • *ContainerContext.

Resets context if it is not supported.

func (*Token) SetExp

func (t *Token) SetExp(exp uint64)

SetExp sets epoch number of the token expiration.

func (*Token) SetID

func (t *Token) SetID(v []byte)

SetID sets Token identifier.

func (*Token) SetIat

func (t *Token) SetIat(iat uint64)

SetIat sets the number of the epoch in which the token was issued.

func (*Token) SetNbf

func (t *Token) SetNbf(nbf uint64)

SetNbf sets starting epoch number of the token.

func (*Token) SetOwnerID

func (t *Token) SetOwnerID(v *owner.ID)

SetOwnerID sets Token's owner identifier.

func (*Token) SetSessionKey

func (t *Token) SetSessionKey(v []byte)

SetSessionKey sets public key of the session in a binary format.

func (*Token) SignECDSA

func (t *Token) SignECDSA(key ecdsa.PrivateKey) error

SignECDSA calculates and writes ECDSA signature of the Token data.

Returns signature calculation errors.

func (*Token) Signature

func (t *Token) Signature() *pkg.Signature

Signature returns Token signature.

func (*Token) ToV2

func (t *Token) ToV2() *session.SessionToken

ToV2 converts Token to session.SessionToken message structure.

Nil Token converts to nil.

func (*Token) Unmarshal

func (t *Token) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of Token.

func (*Token) UnmarshalJSON

func (t *Token) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes Token from protobuf JSON format.

func (*Token) VerifySignature

func (t *Token) VerifySignature() bool

VerifySignature checks if token signature is presented and valid.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL