Help us shape the future of Go! Take the 2026 Go Developer Survey

application

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package application holds the PluginManager — the central coordinator for plugin lifecycle: deploy, stop, configure, health-check, and gRPC routing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveSecretKey

func DeriveSecretKey(raw string) []byte

DeriveSecretKey derives a 32-byte AES-256 key from the SECRET_KEY env var using SHA-256. Call this during bootstrap.

Types

type Manager

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

Manager implements ports.PluginManager.

func New

func New(
	store ports.PluginStore,
	registry ports.PluginRegistry,
	rt runtime.RuntimeAdapter,
	secretKey []byte,
	projectName string,
	companionEnv map[string]string,
	logger *slog.Logger,
) *Manager

New creates a PluginManager and starts the background health-check loop. secretKey is used for AES-256-GCM encryption of plugin secrets; it must be exactly 32 bytes (derive with SHA-256 from SECRET_KEY env var).

func (*Manager) ChangePassword added in v0.1.2

func (m *Manager) ChangePassword(ctx context.Context, userID, currentPassword, newPassword string) error

func (*Manager) Disable

func (m *Manager) Disable(ctx context.Context, pluginID string) error

Disable stops the container and closes the gRPC connection.

func (*Manager) Enable

func (m *Manager) Enable(ctx context.Context, pluginID string) error

Enable starts the container and re-opens the gRPC connection.

func (*Manager) GetActiveIDPID added in v0.1.2

func (m *Manager) GetActiveIDPID() string

func (*Manager) GetOIDCConfig

func (m *Manager) GetOIDCConfig(ctx context.Context) (*pluginsv1.OIDCConfig, error)

func (*Manager) GetPlugin

func (m *Manager) GetPlugin(ctx context.Context, pluginID string) (*domain.Plugin, error)

GetPlugin returns the persisted plugin with its current in-memory status.

func (*Manager) GetUIManifests

func (m *Manager) GetUIManifests(ctx context.Context) ([]*pluginsv1.UIManifest, error)

GetUIManifests collects UIManifest from every plugin that declared CapabilityUIManifest.

func (*Manager) HandlePluginRoute

func (m *Manager) HandlePluginRoute(ctx context.Context, pluginID string, req *pluginsv1.HTTPRequest) (*pluginsv1.HTTPResponse, error)

HandlePluginRoute forwards an HTTP request to the plugin's Handle gRPC method.

func (*Manager) HasIdentityProvider

func (m *Manager) HasIdentityProvider() bool

HasIdentityProvider reports whether an IDP plugin has been configured. It returns true as soon as SetActiveIDP is called — before capability discovery completes — so the frontend doesn't redirect back to setup while the plugin starts.

func (*Manager) IDPReady added in v0.1.2

func (m *Manager) IDPReady() bool

IDPReady reports whether the active IDP plugin has completed capability discovery. This is used to gate the frontend login page — returning false means the plugin container is starting up and the caller should show a loading state.

func (*Manager) Install

func (m *Manager) Install(ctx context.Context, manifest *domain.CatalogManifest, config map[string]string) (*domain.Plugin, error)

Install deploys a new plugin container, persists config, and dials gRPC.

func (*Manager) ListPlugins

func (m *Manager) ListPlugins(ctx context.Context) ([]*domain.Plugin, error)

ListPlugins returns all installed plugins with in-memory statuses.

func (*Manager) ListSessions added in v0.1.2

func (m *Manager) ListSessions(ctx context.Context, userID, currentSessionID string) ([]*pluginsv1.Session, error)

func (*Manager) Login

func (m *Manager) Login(ctx context.Context, username, password string) (*pluginsv1.TokenSet, error)

func (*Manager) MatchPluginRoute

func (m *Manager) MatchPluginRoute(method, path string) (pluginID string, public bool, ok bool)

MatchPluginRoute returns the plugin ID and public flag for the first route that matches the given method and path, or ok=false if none match.

func (*Manager) Reconfigure

func (m *Manager) Reconfigure(ctx context.Context, pluginID string, config map[string]string) error

Reconfigure restarts the container with updated config.

func (*Manager) RefreshToken

func (m *Manager) RefreshToken(ctx context.Context, refreshToken string) (*pluginsv1.TokenSet, error)

func (*Manager) Register

func (m *Manager) Register(ctx context.Context, req *pluginsv1.RegisterRequest) (string, error)

func (*Manager) Remove

func (m *Manager) Remove(ctx context.Context, pluginID string) error

Remove stops the container, removes the DB record, and closes the gRPC connection.

func (*Manager) RevokeAllSessions added in v0.1.2

func (m *Manager) RevokeAllSessions(ctx context.Context, userID, currentSessionID string) error

func (*Manager) RevokeSession added in v0.1.2

func (m *Manager) RevokeSession(ctx context.Context, userID, sessionID string) error

func (*Manager) RunMiddleware

func (m *Manager) RunMiddleware(ctx context.Context, userID string, roles []string, method, path string) error

RunMiddleware fans out OnRequest to all plugins that declared CapabilityAPIMiddleware. RunMiddleware fans out OnRequest to all plugins that declared CapabilityAPIMiddleware. The platform has already validated the token; userID and roles are the verified identity. Returns a non-nil error if any plugin denies the request.

func (*Manager) SetActiveIDP

func (m *Manager) SetActiveIDP(ctx context.Context, pluginID string) error

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start loads all enabled plugins from the store, ensures their containers are running, and starts the background health-check goroutine. Call this after the DB is ready.

func (*Manager) ValidateToken

func (m *Manager) ValidateToken(ctx context.Context, token string) (*pluginsv1.TokenClaims, error)

Jump to

Keyboard shortcuts

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