authmate

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent contains client communicating with FrostFS and logger.

func New

func New(log *zap.Logger, frostFS FrostFS) *Agent

New creates an object of type Agent that consists of Client and logger.

func (*Agent) IssueSecret

func (a *Agent) IssueSecret(ctx context.Context, w io.Writer, options *IssueSecretOptions) error

IssueSecret creates an auth token, puts it in the FrostFS network and writes to io.Writer a new secret access key.

func (*Agent) ObtainSecret

func (a *Agent) ObtainSecret(ctx context.Context, w io.Writer, options *ObtainSecretOptions) error

ObtainSecret receives an existing secret access key from FrostFS and writes to io.Writer the secret access key.

func (*Agent) UpdateSecret added in v0.28.0

func (a *Agent) UpdateSecret(ctx context.Context, w io.Writer, options *UpdateSecretOptions) error

UpdateSecret updates an auth token (change list of gates that can use credential), puts new cred version to the FrostFS network and writes to io.Writer a result.

type ContainerOptions

type ContainerOptions struct {
	ID              cid.ID
	FriendlyName    string
	PlacementPolicy string
}

ContainerOptions groups parameters of auth container to put the secret into.

type ContainerPolicies

type ContainerPolicies map[string]string

ContainerPolicies contains mapping of aws LocationConstraint to frostfs PlacementPolicy.

type FrostFS

type FrostFS interface {
	// FrostFS interface required by credential tool.
	tokens.FrostFS

	// ContainerExists checks container presence in FrostFS by identifier.
	// Returns nil if container exists.
	ContainerExists(context.Context, cid.ID) error

	// CreateContainer creates and saves parameterized container in FrostFS.
	// It sets 'Timestamp' attribute to the current time.
	// It returns the ID of the saved container.
	//
	// The container must be private with GET access for OTHERS group.
	// Creation time should also be stamped.
	//
	// It returns exactly one non-nil value. It returns any error encountered which
	// prevented the container from being created.
	CreateContainer(context.Context, PrmContainerCreate) (cid.ID, error)

	// TimeToEpoch computes the current epoch and the epoch that corresponds to the provided time.
	// Note:
	// * time must be in the future
	// * time will be ceil rounded to match epoch
	//
	// It returns any error encountered which prevented computing epochs.
	TimeToEpoch(context.Context, time.Time) (uint64, uint64, error)
}

FrostFS represents virtual connection to FrostFS network.

type IssueSecretOptions

type IssueSecretOptions struct {
	Container             ContainerOptions
	FrostFSKey            *keys.PrivateKey
	GatesPublicKeys       []*keys.PublicKey
	EACLRules             []byte
	Impersonate           bool
	SessionTokenRules     []byte
	SkipSessionRules      bool
	Lifetime              time.Duration
	AwsCliCredentialsFile string
	ContainerPolicies     ContainerPolicies
}

IssueSecretOptions contains options for passing to Agent.IssueSecret method.

type NetworkState

type NetworkState struct {
	// Current FrostFS time.
	Epoch uint64
	// Duration of the Morph chain block in ms.
	BlockDuration int64
	// Duration of the FrostFS epoch in Morph chain blocks.
	EpochDuration uint64
}

NetworkState represents FrostFS network state which is needed for authmate processing.

type ObtainSecretOptions

type ObtainSecretOptions struct {
	SecretAddress  string
	GatePrivateKey *keys.PrivateKey
}

ObtainSecretOptions contains options for passing to Agent.ObtainSecret method.

type PrmContainerCreate

type PrmContainerCreate struct {
	// FrostFS identifier of the container creator.
	Owner user.ID

	// Container placement policy.
	Policy netmap.PlacementPolicy

	// Friendly name for the container (optional).
	FriendlyName string
}

PrmContainerCreate groups parameters of containers created by authmate.

type UpdateOptions added in v0.28.0

type UpdateOptions struct {
	Address         oid.Address
	SecretAccessKey []byte
}

UpdateOptions groups parameters to update existing the secret into.

type UpdateSecretOptions added in v0.28.0

type UpdateSecretOptions struct {
	FrostFSKey      *keys.PrivateKey
	GatesPublicKeys []*keys.PublicKey
	Address         oid.Address
	GatePrivateKey  *keys.PrivateKey
}

UpdateSecretOptions contains options for passing to Agent.UpdateSecret method.

Jump to

Keyboard shortcuts

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