Documentation
¶
Index ¶
- func NewAuthInterceptor(adminToken string, db *sql.DB, oidc *auth.OIDCAuth) connect.Interceptor
- func RegisterHandlers(mux *http.ServeMux, h *Handlers, adminToken string, db *sql.DB, ...)
- func RegisterOIDCRoutes(mux *http.ServeMux, oidc *auth.OIDCAuth, teams TeamResolver)
- type EventBus
- func (b *EventBus) CloseAll()
- func (b *EventBus) PublishFleetUpdate(update *apiv1.FleetUpdate)
- func (b *EventBus) PublishTaskEvent(taskID, eventID, status, eventType, summary, payload, createdAt string)
- func (b *EventBus) SubscribeFleetUpdates(bufSize int) (<-chan *apiv1.FleetUpdate, func())
- func (b *EventBus) SubscribeTaskEvents(taskID string, bufSize int) (<-chan *apiv1.TaskEvent, func())
- type Handlers
- type TeamResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAuthInterceptor ¶
func RegisterHandlers ¶
func RegisterHandlers(mux *http.ServeMux, h *Handlers, adminToken string, db *sql.DB, oidc *auth.OIDCAuth, teams TeamResolver)
RegisterHandlers mounts all ConnectRPC service handlers on the given mux. The ArcaneService is only registered if Arcane is configured. When oidc is non-nil the web UI OIDC login flow is registered and session cookies are accepted alongside bearer tokens. teams backs the OIDC group-to-team mapping and may be nil (group names are then kept as-is).
func RegisterOIDCRoutes ¶
func RegisterOIDCRoutes(mux *http.ServeMux, oidc *auth.OIDCAuth, teams TeamResolver)
RegisterOIDCRoutes mounts the web UI OIDC login flow. It is a no-op when oidc is nil (OIDC not configured). teams may be nil; group-derived team names are then kept as-is.
GET /auth/login — redirect to the IdP authorization endpoint GET /auth/callback — exchange the code, mint a session, set the cookie GET/POST /auth/logout — clear the session cookie, redirect to IdP logout GET /auth/session — report session state to the SPA (200/401)
Types ¶
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
EventBus provides in-memory fan-out of task events and fleet updates to subscribed streaming RPC clients. It is a best-effort notification layer — subscribers should use DB queries as the source of truth for missed events on reconnect.
func NewEventBus ¶
func NewEventBus() *EventBus
func (*EventBus) CloseAll ¶
func (b *EventBus) CloseAll()
CloseAll closes all subscriber channels. Called on server shutdown.
func (*EventBus) PublishFleetUpdate ¶
func (b *EventBus) PublishFleetUpdate(update *apiv1.FleetUpdate)
PublishFleetUpdate fans out a fleet-level update (runner registered/lost) to all fleet subscribers.
func (*EventBus) PublishTaskEvent ¶
func (b *EventBus) PublishTaskEvent(taskID, eventID, status, eventType, summary, payload, createdAt string)
PublishTaskEvent implements service.TaskEventPublisher using plain-string parameters (avoids import cycle between service and webapi packages).
func (*EventBus) SubscribeFleetUpdates ¶
func (b *EventBus) SubscribeFleetUpdates(bufSize int) (<-chan *apiv1.FleetUpdate, func())
SubscribeFleetUpdates registers a subscriber for fleet-wide updates.
func (*EventBus) SubscribeTaskEvents ¶
func (b *EventBus) SubscribeTaskEvents(taskID string, bufSize int) (<-chan *apiv1.TaskEvent, func())
SubscribeTaskEvents registers a subscriber for a specific task's events. Returns a channel and an unsubscribe function. The channel is buffered with the given capacity. Events are dropped (non-blocking) if the subscriber is too slow — clients should use the DB cursor on reconnect to recover missed events.
type Handlers ¶
type Handlers struct {
Task *taskHandler
Event *eventHandler
Session *sessionHandler
Trigger *triggerHandler
EventCallback *eventCallbackHandler
Fleet *fleetHandler
Admin *adminHandler
Arcane *arcaneHandler
Catalog *catalogHandler
}
Handlers holds all ConnectRPC handler implementations.
type TeamResolver ¶
type TeamResolver interface {
// ListTeams returns all teams, used to resolve group-derived names to
// team IDs and to apply okta_group_id/okta_group_name overrides.
ListTeams(ctx context.Context) ([]repository.Team, error)
}
TeamResolver is the team lookup surface the OIDC handlers need. It is satisfied by the dialect-agnostic data facade (internal/data), so group-to-team mapping goes through the generated dual-dialect queries instead of hand-rolled SQL with dialect fallbacks.