admin

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound     = errors.New("user not found")
	ErrCannotDeleteSelf = errors.New("cannot delete your own account")
)

Functions

func GetTracer

func GetTracer() trace.Tracer

GetTracer returns the configured tracer

func InitTracer

func InitTracer(serviceName, otelEndpoint string, logger l.Logger) (func(context.Context) error, error)

InitTracer initializes the OpenTelemetry tracer

func InitTracerWithContext added in v0.8.0

func InitTracerWithContext(ctx context.Context, serviceName, otelEndpoint string, logger l.Logger) (func(context.Context) error, error)

InitTracerWithContext initializes the OpenTelemetry tracer using the caller's lifecycle for exporter and resource setup.

func StreamAuthInterceptor

func StreamAuthInterceptor(auth *Authenticator, logger l.Logger) grpc.StreamServerInterceptor

func StreamTracingInterceptor

func StreamTracingInterceptor(logger l.Logger) grpc.StreamServerInterceptor

StreamTracingInterceptor returns a gRPC streaming interceptor that adds OpenTelemetry tracing

func UnaryAuthInterceptor

func UnaryAuthInterceptor(auth *Authenticator, logger l.Logger) grpc.UnaryServerInterceptor

func UnaryPerformanceInterceptor

func UnaryPerformanceInterceptor() grpc.UnaryServerInterceptor

middleware to measure performance of grpc requests

func UnaryTracingInterceptor

func UnaryTracingInterceptor(logger l.Logger) grpc.UnaryServerInterceptor

UnaryTracingInterceptor returns a gRPC unary interceptor that adds OpenTelemetry tracing

Types

type AdminServiceServer

type AdminServiceServer struct {
	grpcapi.UnimplementedAdminServer
	// contains filtered or unexported fields
}

AdminServiceServer implements the Admin gRPC service

func NewGRPCAdminServer

func NewGRPCAdminServer(
	logger l.Logger,
	boundary string,
	getEvents GetEventsFunc,
	saveEvents SaveEventsFunc,
	listAdminUsers ListAdminUsersFunc,
	authenticator CredentialsValidator,
) *AdminServiceServer

NewGRPCAdminServer creates a new AdminServiceServer

func NewGRPCAdminServerWithBoundaryCommands added in v0.8.0

func NewGRPCAdminServerWithBoundaryCommands(
	logger l.Logger,
	boundary string,
	getEvents GetEventsFunc,
	saveEvents SaveEventsFunc,
	listAdminUsers ListAdminUsersFunc,
	authenticator CredentialsValidator,
	boundarySaver orisun.EventsSaver,
	boundaryReader orisun.EventsRetriever,
) *AdminServiceServer

func NewGRPCAdminServerWithDependencies added in v0.8.0

func NewGRPCAdminServerWithDependencies(
	logger l.Logger,
	boundary string,
	dependencies GRPCAdminDependencies,
) *AdminServiceServer

func (*AdminServiceServer) ChangePassword

ChangePassword changes a user's password

func (*AdminServiceServer) CreateBoundary added in v0.8.0

CreateBoundary emits the definition event. Physical provisioning is handled asynchronously by the boundary_provisioning slice subscriber.

func (*AdminServiceServer) CreateUser

CreateUser creates a new user with the given details

func (*AdminServiceServer) DeleteUser

DeleteUser deletes a user by ID

func (*AdminServiceServer) GetBoundary added in v0.8.0

func (*AdminServiceServer) GetEventCount

GetEventCount returns the number of events in a boundary

func (*AdminServiceServer) GetUserCount

GetUserCount returns the total number of users

func (*AdminServiceServer) ListBoundaries added in v0.8.0

func (*AdminServiceServer) ListUsers

ListUsers returns all users

func (*AdminServiceServer) ValidateCredentials

ValidateCredentials validates username and password

type AuthUserProjector

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

func NewAuthUserProjector

func NewAuthUserProjector(
	logger logger.Logger,
	subscribeToEvents admin_common.SubscribeToEventStoreType,
	boundary string,
) *AuthUserProjector

func (*AuthUserProjector) Start

func (p *AuthUserProjector) Start(ctx context.Context) error

type Authenticator

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

func NewAuthenticator

func NewAuthenticator(getEvents admin_common.GetEventsType, logger logger.Logger,
	boundary string, getUserByUsername func(username string) (orisun.User, error)) *Authenticator

func (*Authenticator) ValidateCredentials

func (a *Authenticator) ValidateCredentials(ctx context.Context, username string, password string) (orisun.User, string, error)

func (*Authenticator) ValidateToken

func (a *Authenticator) ValidateToken(ctx context.Context, token string) (*orisun.User, error)

type CredentialsValidator added in v0.8.0

type CredentialsValidator interface {
	ValidateCredentials(context.Context, string, string) (orisun.User, string, error)
}

type GRPCAdminDependencies added in v0.8.0

type GRPCAdminDependencies struct {
	GetEvents            GetEventsFunc
	SaveEvents           SaveEventsFunc
	ListAdminUsers       ListAdminUsersFunc
	GetUserCount         GetUserCountFunc
	GetEventCount        GetEventCountFunc
	CredentialsValidator CredentialsValidator
	BoundarySaver        orisun.EventsSaver
	BoundaryReader       orisun.EventsRetriever
}

type GetEventCountFunc added in v0.8.0

type GetEventCountFunc func(boundary string) (int, error)

type GetEventsFunc

type GetEventsFunc func(ctx context.Context, req *orisun.GetEventsRequest) (*orisun.GetEventsResponse, error)

GetEventsFunc is the function signature for getting events

type GetUserCountFunc added in v0.8.0

type GetUserCountFunc func() (uint32, error)

type ListAdminUsersFunc

type ListAdminUsersFunc func() ([]*orisun.User, error)

ListAdminUsersFunc is the function signature for listing admin users

type SaveEventsFunc

type SaveEventsFunc func(ctx context.Context, req *orisun.SaveEventsRequest) (*orisun.WriteResult, error)

SaveEventsFunc is the function signature for saving events

Directories

Path Synopsis
slices
boundary_catalog
Package boundary_catalog projects boundary lifecycle events into a catalog.
Package boundary_catalog projects boundary lifecycle events into a catalog.

Jump to

Keyboard shortcuts

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