routers

package
v1.108.17 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiFilter

func ApiFilter(c *zip.Ctx) error

ApiFilter is the ONE authorization seam — ZAP middleware that authorizes every request against the static Casbin policy (authz.IsAllowed) on the resolved subject/object, denying with 403 or threading the request through to the handler via c.Next(). It runs after the tenant filter and before the record filter, exactly as the Beego BeforeRouter chain did.

func GetSessionUser

func GetSessionUser(c *zip.Ctx) *iamsdk.User

GetSessionUser resolves the caller from the forwarded IAM Bearer JWT — the ONE stateless identity seam. There is no cookie or server-side session: an API/console caller presents a short-lived Bearer, verified and brand-bound in object.GetBearerUser.

func RecordMessage

func RecordMessage(c *zip.Ctx) error

RecordMessage is the audit-record middleware. Beego split this into a BeforeRouter hook (stash the acting user) and an AfterExec hook (build+persist the record from the response); ZAP composes both around one c.Next() — the before-work stashes the user id, the handler runs, then the after-work reads the response envelope the handler stashed and writes the audit record. Login, signup and get-assets are exempted from the user-id stash exactly as before.

func Route added in v1.108.15

func Route(app *zip.App)

Route mounts the whole visor HTTP surface on app: the ambient filter chain (recover, CORS, static, tenant, authz, record) followed by the /v1 API. The filter order is the Beego BeforeRouter chain preserved exactly — static short- circuits before the authz seam, so an asset is never gated; every /v1 route registered after the chain is tenant-scoped, authorized and audited.

func TenantContextFilter

func TenantContextFilter(c *zip.Ctx) error

TenantContextFilter is the ZAP middleware seam: it threads the tenant scope onto the request, then continues the chain via c.Next(). The scope transform itself is applyTenantContext, kept separate from the plumbing so it is unit- testable without a routed context.

func TransparentStatic

func TransparentStatic(c *zip.Ctx) error

TransparentStatic is the FIRST request filter after recover/CORS. It replaces Beego's BeforeRouter static filter one-for-one: a /v1/ request threads through (c.Next()) to the tenant/authz/record chain and the API routes; anything else is served from the web build with an index.html SPA fallback (or from the swagger root), short-circuiting the chain so no static asset is ever authz-gated or audit-recorded.

Types

type Object

type Object struct {
	Owner        string `json:"owner"`
	Name         string `json:"name"`
	AccessKey    string `json:"accessKey"`
	AccessSecret string `json:"accessSecret"`
}

type Response

type Response struct {
	Status string      `json:"status"`
	Msg    string      `json:"msg"`
	Data   interface{} `json:"data"`
	Data2  interface{} `json:"data2"`
}

Jump to

Keyboard shortcuts

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