types

package
v0.0.0-...-a8b8e24 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const LegacyTokenDescription = "Legacy data collector token ported from A1"

Variables

This section is empty.

Functions

This section is empty.

Types

type ConflictError

type ConflictError struct{}

ConflictError is the error returned when the token creation request specifies an ID that has already been used

func (*ConflictError) Error

func (e *ConflictError) Error() string

type NotFoundError

type NotFoundError struct{}

NotFoundError is the error returned when the token wasn't found, to discern this from other errors -- failures to reach the backend services, etc.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type ProjectValidator

type ProjectValidator interface {
	ValidateProjectAssignment(context.Context, *authz.ValidateProjectAssignmentReq, ...grpc.CallOption) (*authz.ValidateProjectAssignmentResp, error)
}

ProjectValidator is a more limited interface for authz-service

type Resetter

type Resetter interface {
	Reset(context.Context) error
}

Resetter allows resetting the adapter to factory settings (e.g. deletes all data) -- use with caution

type Storage

type Storage interface {
	CreateToken(ctx context.Context, id, name string, active bool, projects []string) (*Token, error)
	CreateTokenWithValue(ctx context.Context, id, value, name string,
		active bool, projects []string) (*Token, error)
	CreateLegacyTokenWithValue(ctx context.Context, value string) (*Token, error)
	DeleteToken(context.Context, string) error
	UpdateToken(ctx context.Context, id, name string, active bool, projects []string) (*Token, error)
	GetToken(context.Context, string) (*Token, error)
	GetTokenIDWithValue(ctx context.Context, value string) (string, error)
	GetTokens(context.Context) ([]*Token, error)
	PurgeProject(context.Context, string) error
}

Storage is the interface for various adapters

type Token

type Token struct {
	ID       string
	Name     string
	Value    string
	Active   bool
	Created  time.Time
	Updated  time.Time
	Projects []string
}

Token represents a token we are able to use to authenticate: the ID is arbitrary, the Token will be checked for in incoming requests.

type TokenConfig

type TokenConfig interface {
	Open(*certs.ServiceCerts, *zap.Logger, ProjectValidator) (Storage, error)
}

TokenConfig is a configuration that can open a storage adapter

Jump to

Keyboard shortcuts

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