http

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(mux webx.Router, d Deps)

func MountBillingOps

func MountBillingOps(mux webx.Router, d BillingOpsDeps)

func MountUserOps

func MountUserOps(mux webx.Router, d UserOpsDeps)

func MountWsOps

func MountWsOps(mux webx.Router, d WsOpsDeps)

func PlatformAdminGuard added in v0.8.0

func PlatformAdminGuard() func(http.Handler) http.Handler

PlatformAdminGuard returns the platform-admin middleware: it requires an authenticated principal that is a platform admin, in a non-impersonated browser session (PATs are rejected). This is the exported form of the guard every admin route runs behind (see Deps.requireAdmin); products mounting their own admin-facing endpoints (e.g. settingshttp.AdminDeps.Guard) should pass this instead of a hand-written closure, which historically missed the impersonation and PAT defenses.

Types

type AuditRecorder

type AuditRecorder interface {
	Record(ctx context.Context, workspaceID *string, p *webx.Principal, action, resourceType, resourceID string, meta map[string]any)
}

type BillingOpsDeps

type BillingOpsDeps struct {
	Svc *app.BillingOpsService
}

type Deps

type Deps struct {
	Svc *app.AdminService

	Rec AuditRecorder

	Sessions SessionMinter

	AuthCfg *webx.AuthConfig

	Hooks *admin.Hooks
}

type SessionMinter

type SessionMinter interface {
	CreateSession(ctx context.Context, in webx.SessionCreate) (token string, exp time.Time, err error)
	CreateImpersonatedSession(ctx context.Context, userID, impersonatedBy, ipHash, userAgent string, now time.Time) (string, time.Time, error)
}

type UserOpsDeps

type UserOpsDeps struct {
	Deps
	Ops *app.UserOpsService
}

type WsOpsDeps

type WsOpsDeps struct {
	Svc *app.WsOpsService
}

Jump to

Keyboard shortcuts

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