Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PluginManager ¶
type PluginManager interface {
// Install deploys the plugin container, persists its config, and opens the
// gRPC connection.
Install(ctx context.Context, manifest *domain.CatalogManifest, config map[string]string) (*domain.Plugin, error)
// Remove stops the container, removes the DB record, and closes the gRPC connection.
Remove(ctx context.Context, pluginID string) error
// Enable starts the container and re-opens the gRPC connection.
Enable(ctx context.Context, pluginID string) error
// Disable stops the container and closes the gRPC connection (config preserved).
Disable(ctx context.Context, pluginID string) error
// Reconfigure restarts the container with updated env vars and persists the new config.
Reconfigure(ctx context.Context, pluginID string, config map[string]string) error
// GetPlugin returns the persisted plugin record with its current in-memory status.
GetPlugin(ctx context.Context, pluginID string) (*domain.Plugin, error)
// ListPlugins returns all installed plugins with their current statuses.
ListPlugins(ctx context.Context) ([]*domain.Plugin, error)
// SetActiveIDP designates a plugin as the active identity provider.
SetActiveIDP(ctx context.Context, pluginID string) error
// GetActiveIDPID returns the ID of the currently active IDP plugin, or "" if none.
GetActiveIDPID() string
// Login authenticates a user via the active IDP plugin.
// Returns ErrNoIDP if no active IDP is configured.
Login(ctx context.Context, username, password string) (*pluginsv1.TokenSet, error)
// Register creates a new user via the active IDP plugin.
// Returns ErrNoIDP if no active IDP is configured.
Register(ctx context.Context, req *pluginsv1.RegisterRequest) (string, error)
// ValidateToken verifies a bearer token via the active IDP plugin.
// Used by RequireAuth middleware on every authenticated request.
ValidateToken(ctx context.Context, token string) (*pluginsv1.TokenClaims, error)
// GetOIDCConfig returns the OIDC discovery config from the active IDP plugin.
// Returns nil, nil when no IDP is active.
GetOIDCConfig(ctx context.Context) (*pluginsv1.OIDCConfig, error)
// RefreshToken exchanges a refresh token for a new token set via the active IDP plugin.
// Returns ErrNoIDP if no active IDP is configured.
RefreshToken(ctx context.Context, refreshToken string) (*pluginsv1.TokenSet, error)
// ChangePassword verifies the current password and sets a new one via the active IDP plugin.
ChangePassword(ctx context.Context, userID, currentPassword, newPassword string) error
// ListSessions returns all active sessions for a user via the active IDP plugin.
ListSessions(ctx context.Context, userID, currentSessionID string) ([]*pluginsv1.Session, error)
// RevokeSession terminates a specific session via the active IDP plugin.
RevokeSession(ctx context.Context, userID, sessionID string) error
// RevokeAllSessions terminates every session for a user except the current one.
// currentSessionID is the session that should be preserved.
RevokeAllSessions(ctx context.Context, userID, currentSessionID string) error
// HasIdentityProvider reports whether at least one active plugin declared
// the CapabilityIdentityProvider capability.
HasIdentityProvider() bool
// IDPReady reports whether the active IDP plugin has completed capability
// discovery and is ready to serve auth requests. Use this to gate the
// frontend login page while the plugin container is starting up.
IDPReady() bool
// RunMiddleware calls OnRequest on every plugin that declared CapabilityAPIMiddleware.
// Returns a non-nil error if any plugin denies the request.
RunMiddleware(ctx context.Context, userID string, roles []string, method, path string) error
// GetUIManifests aggregates UI contributions from all active plugins.
GetUIManifests(ctx context.Context) ([]*pluginsv1.UIManifest, error)
// MatchPluginRoute checks whether any plugin owns the given method+path.
MatchPluginRoute(method, path string) (pluginID string, public bool, ok bool)
// HandlePluginRoute forwards an HTTP request to the given plugin via gRPC.
HandlePluginRoute(ctx context.Context, pluginID string, req *pluginsv1.HTTPRequest) (*pluginsv1.HTTPResponse, error)
}
PluginManager owns the full lifecycle of installed plugins. It is the single authoritative source for gRPC connections and runtime state.
type PluginRegistry ¶
type PluginRegistry interface {
// ListCatalog returns all plugins in the cached catalog.
// Fetches from the remote URL on first call and caches with the configured TTL.
ListCatalog(ctx context.Context) ([]*domain.CatalogManifest, error)
// GetManifest returns the catalog entry for the given plugin ID.
// Returns nil, nil if not found.
GetManifest(ctx context.Context, pluginID string) (*domain.CatalogManifest, error)
// Refresh forces a re-fetch of the catalog from the remote registry.
Refresh(ctx context.Context) error
// CachedAt returns the timestamp of the last successful catalog fetch.
// Returns the zero time if the catalog has never been fetched.
CachedAt() string // RFC3339 or ""
}
PluginRegistry fetches and caches the remote plugin catalog.
type PluginStore ¶
type PluginStore interface {
// FindByID returns an installed plugin by its manifest ID.
FindByID(ctx context.Context, id string) (*domain.Plugin, error)
// ListAll returns every installed plugin.
ListAll(ctx context.Context) ([]*domain.Plugin, error)
// ListByType returns all installed plugins of the given type.
ListByType(ctx context.Context, pluginType string) ([]*domain.Plugin, error)
// Save upserts a plugin record (insert or update by ID).
Save(ctx context.Context, p *domain.Plugin) error
// Delete removes a plugin record by ID.
Delete(ctx context.Context, id string) error
// GetSetting returns the value of a named settings key.
// Returns "", nil if the key does not exist.
GetSetting(ctx context.Context, key string) (string, error)
// SetSetting upserts a named settings key.
SetSetting(ctx context.Context, key, value string) error
}
PluginStore persists installed plugin records and the active-plugin settings. Schema: see migrations/003_create_plugins.sql and 004_create_settings.sql.
Click to show internal directories.
Click to hide internal directories.