Documentation
¶
Index ¶
- Constants
- Variables
- func GetTracer() trace.Tracer
- func InitTelemetryWithContext(ctx context.Context, serviceName, otelEndpoint string, logger l.Logger) (func(context.Context) error, error)
- func InitTracer(serviceName, otelEndpoint string, logger l.Logger) (func(context.Context) error, error)
- func InitTracerWithContext(ctx context.Context, serviceName, otelEndpoint string, logger l.Logger) (func(context.Context) error, error)
- func StreamAuthInterceptor(auth *Authenticator, logger l.Logger) grpc.StreamServerInterceptor
- func StreamMetricsInterceptor() grpc.StreamServerInterceptor
- func StreamTracingInterceptor(logger l.Logger) grpc.StreamServerInterceptor
- func UnaryAuthInterceptor(auth *Authenticator, logger l.Logger) grpc.UnaryServerInterceptor
- func UnaryMetricsInterceptor() grpc.UnaryServerInterceptor
- func UnaryPerformanceInterceptor() grpc.UnaryServerInterceptor
- func UnaryTracingInterceptor(logger l.Logger) grpc.UnaryServerInterceptor
- type AdminServiceServer
- func NewGRPCAdminServer(logger l.Logger, boundary string, getEvents GetEventsFunc, ...) *AdminServiceServer
- func NewGRPCAdminServerWithBoundaryCommands(logger l.Logger, boundary string, getEvents GetEventsFunc, ...) *AdminServiceServer
- func NewGRPCAdminServerWithDependencies(logger l.Logger, boundary string, dependencies GRPCAdminDependencies) *AdminServiceServer
- func (s *AdminServiceServer) ChangePassword(ctx context.Context, req *grpcapi.ChangePasswordRequest) (*grpcapi.ChangePasswordResponse, error)
- func (s *AdminServiceServer) CreateBoundary(ctx context.Context, req *grpcapi.CreateBoundaryRequest) (*grpcapi.CreateBoundaryResponse, error)
- func (s *AdminServiceServer) CreateUser(ctx context.Context, req *grpcapi.CreateUserRequest) (*grpcapi.CreateUserResponse, error)
- func (s *AdminServiceServer) DeleteUser(ctx context.Context, req *grpcapi.DeleteUserRequest) (*grpcapi.DeleteUserResponse, error)
- func (s *AdminServiceServer) GetBoundary(ctx context.Context, req *grpcapi.GetBoundaryRequest) (*grpcapi.GetBoundaryResponse, error)
- func (s *AdminServiceServer) GetEventCount(ctx context.Context, req *grpcapi.GetEventCountRequest) (*grpcapi.GetEventCountResponse, error)
- func (s *AdminServiceServer) GetUserCount(ctx context.Context, _ *grpcapi.GetUserCountRequest) (*grpcapi.GetUserCountResponse, error)
- func (s *AdminServiceServer) ListBoundaries(ctx context.Context, _ *grpcapi.ListBoundariesRequest) (*grpcapi.ListBoundariesResponse, error)
- func (s *AdminServiceServer) ListUsers(ctx context.Context, _ *grpcapi.ListUsersRequest) (*grpcapi.ListUsersResponse, error)
- func (s *AdminServiceServer) ValidateCredentials(ctx context.Context, req *grpcapi.ValidateCredentialsRequest) (*grpcapi.ValidateCredentialsResponse, error)
- type AuthUserProjector
- type Authenticator
- func (a *Authenticator) RevokeUserSessions(userID string) int
- func (a *Authenticator) ValidateCredentials(ctx context.Context, username string, password string) (orisun.User, string, error)
- func (a *Authenticator) ValidateToken(ctx context.Context, token string) (*orisun.User, error)
- func (a *Authenticator) VerifyCredentials(ctx context.Context, username string, password string) (orisun.User, error)
- type CredentialsValidator
- type CredentialsVerifier
- type GRPCAdminDependencies
- type GetEventCountFunc
- type GetEventsFunc
- type GetUserCountFunc
- type ListAdminUsersFunc
- type SaveEventsFunc
- type SessionRevoker
Constants ¶
const ( DefaultSessionTTL = 24 * time.Hour DefaultMaxSessionsPerUser = 16 )
Variables ¶
var ( ErrUserNotFound = errors.New("user not found") ErrCannotDeleteSelf = errors.New("cannot delete your own account") )
Functions ¶
func InitTelemetryWithContext ¶ added in v0.9.3
func InitTelemetryWithContext(ctx context.Context, serviceName, otelEndpoint string, logger l.Logger) (func(context.Context) error, error)
InitTelemetryWithContext initializes OTLP trace and metric exporters using a shared resource and endpoint.
func InitTracer ¶
func InitTracer(serviceName, otelEndpoint string, logger l.Logger) (func(context.Context) error, error)
InitTracer initializes OpenTelemetry traces and metrics. The name is kept for source compatibility with existing embedding code.
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 OpenTelemetry traces and metrics using the caller's lifecycle. The name is kept for source compatibility.
func StreamAuthInterceptor ¶
func StreamAuthInterceptor(auth *Authenticator, logger l.Logger) grpc.StreamServerInterceptor
func StreamMetricsInterceptor ¶ added in v0.9.3
func StreamMetricsInterceptor() grpc.StreamServerInterceptor
StreamMetricsInterceptor records OpenTelemetry metrics for streaming gRPC calls from stream establishment until the handler returns.
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 UnaryMetricsInterceptor ¶ added in v0.9.3
func UnaryMetricsInterceptor() grpc.UnaryServerInterceptor
UnaryMetricsInterceptor records OpenTelemetry metrics for unary gRPC calls.
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 ¶
func (s *AdminServiceServer) ChangePassword(ctx context.Context, req *grpcapi.ChangePasswordRequest) (*grpcapi.ChangePasswordResponse, error)
ChangePassword changes a user's password
func (*AdminServiceServer) CreateBoundary ¶ added in v0.8.0
func (s *AdminServiceServer) CreateBoundary(ctx context.Context, req *grpcapi.CreateBoundaryRequest) (*grpcapi.CreateBoundaryResponse, error)
CreateBoundary emits the definition event. Physical provisioning is handled asynchronously by the boundary_provisioning slice subscriber.
func (*AdminServiceServer) CreateUser ¶
func (s *AdminServiceServer) CreateUser(ctx context.Context, req *grpcapi.CreateUserRequest) (*grpcapi.CreateUserResponse, error)
CreateUser creates a new user with the given details
func (*AdminServiceServer) DeleteUser ¶
func (s *AdminServiceServer) DeleteUser(ctx context.Context, req *grpcapi.DeleteUserRequest) (*grpcapi.DeleteUserResponse, error)
DeleteUser deletes a user by ID
func (*AdminServiceServer) GetBoundary ¶ added in v0.8.0
func (s *AdminServiceServer) GetBoundary(ctx context.Context, req *grpcapi.GetBoundaryRequest) (*grpcapi.GetBoundaryResponse, error)
func (*AdminServiceServer) GetEventCount ¶
func (s *AdminServiceServer) GetEventCount(ctx context.Context, req *grpcapi.GetEventCountRequest) (*grpcapi.GetEventCountResponse, error)
GetEventCount returns the number of events in a boundary
func (*AdminServiceServer) GetUserCount ¶
func (s *AdminServiceServer) GetUserCount(ctx context.Context, _ *grpcapi.GetUserCountRequest) (*grpcapi.GetUserCountResponse, error)
GetUserCount returns the total number of users
func (*AdminServiceServer) ListBoundaries ¶ added in v0.8.0
func (s *AdminServiceServer) ListBoundaries(ctx context.Context, _ *grpcapi.ListBoundariesRequest) (*grpcapi.ListBoundariesResponse, error)
func (*AdminServiceServer) ListUsers ¶
func (s *AdminServiceServer) ListUsers(ctx context.Context, _ *grpcapi.ListUsersRequest) (*grpcapi.ListUsersResponse, error)
ListUsers returns all users
func (*AdminServiceServer) ValidateCredentials ¶
func (s *AdminServiceServer) ValidateCredentials(ctx context.Context, req *grpcapi.ValidateCredentialsRequest) (*grpcapi.ValidateCredentialsResponse, error)
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, revokeSessions ...func(string) int, ) *AuthUserProjector
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(ctx context.Context, username string) (orisun.User, error), sessionTTL ...time.Duration, ) *Authenticator
func (*Authenticator) RevokeUserSessions ¶ added in v0.9.3
func (a *Authenticator) RevokeUserSessions(userID string) int
RevokeUserSessions invalidates every session issued for userID and returns the number of sessions removed.
func (*Authenticator) ValidateCredentials ¶
func (*Authenticator) ValidateToken ¶
func (*Authenticator) VerifyCredentials ¶ added in v0.9.3
func (a *Authenticator) VerifyCredentials(ctx context.Context, username string, password string) (orisun.User, error)
VerifyCredentials validates a username and password without issuing a session. Administrative credential checks use this path so their result does not leave an unreachable live token behind.
type CredentialsValidator ¶ added in v0.8.0
type CredentialsVerifier ¶ added in v0.9.3
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 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 ListAdminUsersFunc ¶
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
type SessionRevoker ¶ added in v0.9.3
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. |