server

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: BSD-3-Clause-Clear Imports: 43 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExternalInterceptorFactoryNameRequired = errors.New("external connect interceptor factory name is required")
	ErrExternalInterceptorFactoryFuncRequired = errors.New("external connect interceptor factory func is required")
)

Functions

func RegisterCoreServices added in v0.10.0

func RegisterCoreServices(reg *serviceregistry.Registry, modes []serviceregistry.ModeName) ([]string, error)

RegisterCoreServices registers the core services using declarative configuration

func RegisterEssentialServices added in v0.10.0

func RegisterEssentialServices(reg *serviceregistry.Registry) error

RegisterEssentialServices registers the essential services directly

func Start

func Start(f ...StartOptions) error

Types

type ConnectServerInterceptor added in v0.30.0

type ConnectServerInterceptor = server.ExtraInterceptor

ConnectServerInterceptor is a programmatic server interceptor in its connect-go v1 and v2 forms. Each service runs the form for its connect-go version, and a service cannot be registered while an interceptor lacks that form, so the interceptor is never skipped.

type InterceptorFactory added in v0.17.0

type InterceptorFactory struct {
	Name    string
	Factory func(InterceptorParams) (ConnectServerInterceptor, error)
}

InterceptorFactory creates a named external Connect interceptor in its connect-go v1 and v2 forms. The factory's Name names the interceptor, and a result with neither form skips registration for that factory.

type InterceptorParams added in v0.17.0

type InterceptorParams struct {
	SDK    *sdk.SDK
	Logger *logger.Logger
	Config config.InterceptorConfig
}

type ServiceName added in v0.10.0

type ServiceName string

ServiceName represents a typed service identifier

var (
	ServiceHealth           ServiceName = "health"
	ServiceKAS              ServiceName = "kas"
	ServicePolicy           ServiceName = "policy"
	ServiceWellKnown        ServiceName = "wellknown"
	ServiceEntityResolution ServiceName = "entityresolution"
	ServiceAuthorization    ServiceName = "authorization"
)

func (ServiceName) String added in v0.10.0

func (s ServiceName) String() string

String returns the string representation of ServiceName

type StartConfig

type StartConfig struct {
	ConfigKey             string
	ConfigFile            string
	WaitForShutdownSignal bool
	PublicRoutes          []string
	IPCReauthRoutes       []string
	// contains filtered or unexported fields
}

type StartOptions

type StartOptions func(StartConfig) StartConfig

func WithAdditionalAuditTypeRegistrations added in v0.25.2

func WithAdditionalAuditTypeRegistrations(registrations audit.TypeRegistrations) StartOptions

WithAdditionalAuditTypeRegistrations centrally registers additional audit object/action/action result types and seals the registration registry during startup to block runtime modifications.

func WithAdditionalCORSExposedHeaders added in v0.12.0

func WithAdditionalCORSExposedHeaders(headers ...string) StartOptions

WithAdditionalCORSExposedHeaders appends additional response headers to expose via CORS. These are merged with headers from YAML config (server.cors.exposedheaders and server.cors.additionalexposedheaders). Deduplication is handled automatically with case-insensitive comparison per RFC 7230.

Example:

server.Start(
    server.WithAdditionalCORSExposedHeaders("X-Request-Id", "X-Trace-Id"),
)

func WithAdditionalCORSHeaders added in v0.12.0

func WithAdditionalCORSHeaders(headers ...string) StartOptions

WithAdditionalCORSHeaders appends additional request headers to allow via CORS. These are merged with headers from YAML config (server.cors.allowedheaders and server.cors.additionalheaders). Deduplication is handled automatically with case-insensitive comparison per RFC 7230.

Example:

server.Start(
    server.WithAdditionalCORSHeaders("X-Custom-Header", "X-Another-Header"),
)

func WithAdditionalCORSMethods added in v0.12.0

func WithAdditionalCORSMethods(methods ...string) StartOptions

WithAdditionalCORSMethods appends additional HTTP methods to allow via CORS. These are merged with methods from YAML config (server.cors.allowedmethods and server.cors.additionalmethods). Deduplication is handled automatically.

Example:

server.Start(
    server.WithAdditionalCORSMethods("CUSTOM", "SPECIAL"),
)

func WithAdditionalConfigLoader added in v0.5.3

func WithAdditionalConfigLoader(loader config.Loader) StartOptions

WithAdditionalConfigLoader option adds an additional configuration loader to the server.

func WithAuditProcessor added in v0.27.0

func WithAuditProcessor(processor audit.Processor) StartOptions

WithAuditProcessor configures instance-scoped canonical audit processing.

func WithAuditTimeout added in v0.27.0

func WithAuditTimeout(timeout time.Duration) StartOptions

WithAuditTimeout sets the audit processing budget. Non-positive values use five seconds.

func WithAuthZRoleProvider added in v0.13.0

func WithAuthZRoleProvider(provider authz.RoleProvider) StartOptions

WithAuthZRoleProvider option sets a role provider directly.

func WithAuthZRoleProviderFactory added in v0.13.0

func WithAuthZRoleProviderFactory(name string, factory authz.RoleProviderFactory) StartOptions

WithAuthZRoleProviderFactory option registers a named role provider factory.

func WithBuiltinAuthZPolicy added in v0.4.30

func WithBuiltinAuthZPolicy(policy string) StartOptions

WithAuthZPolicy option sets the default casbin policy to be used. Example:

  opentdf.WithAuthZPolicy(strings.Join([]string{
	   "p, role:admin, pep*, *, allow",
	   "p, role:standard, pep*, read, allow",
	 }, "\n")),

func WithCasbinAdapter added in v0.4.30

func WithCasbinAdapter(adapter persist.Adapter) StartOptions

WithCasbinAdapter option sets the casbin adapter to be used for the casbin enforcer.

func WithConfigFile

func WithConfigFile(file string) StartOptions

WithConfigFile option sets the configuration file path.

func WithConfigKey

func WithConfigKey(key string) StartOptions

WithConfigKey option sets the viper configuration key(filename).

func WithConfigLoaderOrder added in v0.10.0

func WithConfigLoaderOrder(loaderOrder []string) StartOptions

WithConfigLoaderOrder option is a slice of config.Loader names and is used as the priority of the loaders.

func WithConfigName deprecated

func WithConfigName(name string) StartOptions

Deprecated: Use WithConfigKey WithConfigName option sets the configuration name.

func WithConnectInterceptors added in v0.13.0

func WithConnectInterceptors(interceptors ...ConnectServerInterceptor) StartOptions

WithConnectInterceptors appends server interceptors applied to every RPC on the external server, after the platform's interceptors.

func WithCoreServices added in v0.4.18

func WithCoreServices(services ...serviceregistry.IService) StartOptions

WithCoreServices option adds additional core services to the platform It takes a variadic parameter of type serviceregistry.IService, which represents the core services to be added.

func WithExternalInterceptorFactories added in v0.17.0

func WithExternalInterceptorFactories(factories ...InterceptorFactory) StartOptions

WithExternalInterceptorFactories appends named factories for external Connect interceptors that need access to startup-created clients, such as the IPC SDK connection. Factories are evaluated after the SDK is created and before externally reachable service handlers are registered.

func WithIPCInterceptors added in v0.13.0

func WithIPCInterceptors(interceptors ...ConnectServerInterceptor) StartOptions

WithIPCInterceptors appends server interceptors applied to every RPC on the in-process IPC server, after the platform's interceptors.

func WithIPCReauthRoutes added in v0.5.1

func WithIPCReauthRoutes(routes []string) StartOptions

WithIPCReauthRoutes sets the IPC routes that should be fully reauthorized instead of only rehydrating auth context from propagated metadata.

func WithLoggerContextAttrs added in v0.27.0

func WithLoggerContextAttrs(fns ...logger.ContextAttrFunc) StartOptions

WithLoggerContextAttrs registers functions that derive attributes from each log record's context. This configures the logger, not a mux: the attrs apply to every record a service emits, on both the external and in-process paths.

func WithPublicRoutes

func WithPublicRoutes(routes []string) StartOptions

WithPublicRoutes option sets the public routes for the server. It allows bypassing the authorization middleware for the specified routes. *** This should be used with caution as it can expose sensitive data. ***

func WithServices added in v0.4.18

func WithServices(services ...serviceregistry.IService) StartOptions

WithServices option adds additional services to the platform. It takes a variadic parameter of type serviceregistry.IService, which represents the services to be added.

This will set the mode for these services to the Namespace name. To understand the registration of these services more fully, including the service "mode", follow the usage of the extraServices field in StartConfig.

func WithTrustKeyManagerCtxFactories added in v0.10.0

func WithTrustKeyManagerCtxFactories(factories ...trust.NamedKeyManagerCtxFactory) StartOptions

WithTrustKeyManagerCtxFactories option provides factories for creating trust key managers.

func WithTrustKeyManagerFactories added in v0.7.0

func WithTrustKeyManagerFactories(factories ...trust.NamedKeyManagerFactory) StartOptions

WithTrustKeyManagerFactories option provides factories for creating trust key managers. Use WithTrustKeyManagerCtxFactories instead. EXPERIMENTAL

func WithWaitForShutdownSignal

func WithWaitForShutdownSignal() StartOptions

WithWaitForShutdownSignal option allows the server to wait for a shutdown signal before exiting.

Jump to

Keyboard shortcuts

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