Documentation
¶
Overview ¶
Package application holds the PluginManager — the central coordinator for plugin lifecycle: deploy, stop, configure, health-check, and gRPC routing.
Index ¶
- func DeriveSecretKey(raw string) []byte
- type Manager
- func (m *Manager) ChangePassword(ctx context.Context, userID, currentPassword, newPassword string) error
- func (m *Manager) Disable(ctx context.Context, pluginID string) error
- func (m *Manager) Enable(ctx context.Context, pluginID string) error
- func (m *Manager) GetActiveIDPID() string
- func (m *Manager) GetOIDCConfig(ctx context.Context) (*pluginsv1.OIDCConfig, error)
- func (m *Manager) GetPlugin(ctx context.Context, pluginID string) (*domain.Plugin, error)
- func (m *Manager) GetUIManifests(ctx context.Context) ([]*pluginsv1.UIManifest, error)
- func (m *Manager) HandlePluginRoute(ctx context.Context, pluginID string, req *pluginsv1.HTTPRequest) (*pluginsv1.HTTPResponse, error)
- func (m *Manager) HasIdentityProvider() bool
- func (m *Manager) IDPReady() bool
- func (m *Manager) Install(ctx context.Context, manifest *domain.CatalogManifest, ...) (*domain.Plugin, error)
- func (m *Manager) ListPlugins(ctx context.Context) ([]*domain.Plugin, error)
- func (m *Manager) ListSessions(ctx context.Context, userID, currentSessionID string) ([]*pluginsv1.Session, error)
- func (m *Manager) Login(ctx context.Context, username, password string) (*pluginsv1.TokenSet, error)
- func (m *Manager) MatchPluginRoute(method, path string) (pluginID string, public bool, ok bool)
- func (m *Manager) Reconfigure(ctx context.Context, pluginID string, config map[string]string) error
- func (m *Manager) RefreshToken(ctx context.Context, refreshToken string) (*pluginsv1.TokenSet, error)
- func (m *Manager) Register(ctx context.Context, req *pluginsv1.RegisterRequest) (string, error)
- func (m *Manager) Remove(ctx context.Context, pluginID string) error
- func (m *Manager) RevokeAllSessions(ctx context.Context, userID, currentSessionID string) error
- func (m *Manager) RevokeSession(ctx context.Context, userID, sessionID string) error
- func (m *Manager) RunMiddleware(ctx context.Context, userID string, roles []string, method, path string) error
- func (m *Manager) SetActiveIDP(ctx context.Context, pluginID string) error
- func (m *Manager) Start(ctx context.Context) error
- func (m *Manager) ValidateToken(ctx context.Context, token string) (*pluginsv1.TokenClaims, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveSecretKey ¶
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 (*Manager) GetActiveIDPID ¶ added in v0.1.2
func (*Manager) GetOIDCConfig ¶
func (*Manager) GetPlugin ¶
GetPlugin returns the persisted plugin with its current in-memory status.
func (*Manager) GetUIManifests ¶
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 ¶
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
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 ¶
ListPlugins returns all installed plugins with in-memory statuses.
func (*Manager) ListSessions ¶ added in v0.1.2
func (*Manager) MatchPluginRoute ¶
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 ¶
Reconfigure restarts the container with updated config.
func (*Manager) RefreshToken ¶
func (*Manager) Remove ¶
Remove stops the container, removes the DB record, and closes the gRPC connection.
func (*Manager) RevokeAllSessions ¶ added in v0.1.2
func (*Manager) RevokeSession ¶ added in v0.1.2
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 (*Manager) Start ¶
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.