Skip to content

RU Admin Backend

Andrewkydev edited this page Aug 25, 2026 · 2 revisions

Admin Backend

English: EN-Admin-Backend

Admin — optional management backend, не обязательная часть bot runtime.

Реализованы bootstrap v1/v2, principals/RBAC, web grants и sessions, users/chats/plugins/settings, logs/audit/SSE/metrics, declarative UI, Control WebSocket и durable operations с progress.

Minimal loopback setup

server := api.NewWithDependencies(api.Dependencies{
	App: app, Store: store, Plugins: app.Plugins(), Logs: stream, Logger: logger,
	Auth: verifier, Authorization: policy,
})
if err := server.RegisterPluginModules(app.Plugins()); err != nil {
	log.Fatal(err)
}
defer server.Shutdown(context.Background())
log.Fatal(server.Listen("127.0.0.1:8080"))

В production передайте Auth, Authorization, durable identity/session repositories и необходимые Control/operations dependencies.

Правила безопасности

  • Без Auth protected-запросы fail closed с 401 Unauthorized.
  • Для локальной разработки без аутентификации используйте api.NewInsecureDevelopmentServer() или явно задайте InsecureDevelopment. Его Listen разрешает только explicit loopback host.
  • NewHTTPServer/ServeHTTP сами не проверяют bind address — обеспечьте auth или внешний network boundary.
  • Static verifier подходит только для dev/compatibility.
  • Web grants, session tokens и Control tickets нельзя помещать в URL или логи.
  • RegisterPluginModules вызывается до serving; registration error фатален.
  • Shutdown(ctx) закрывает maintenance, operations, Control sockets и audit dispatcher.

Admin frontend и demo-приложение поддерживаются отдельными репозиториями.

Clone this wiki locally