prerequest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package prerequest defines pre-routing admission handlers for canonical calls.

Index

Constants

This section is empty.

Variables

View Source
var ErrRejected = errors.New("lipsdk/prerequest: pre-request rejected")

ErrRejected is returned when a pre-request handler denies the canonical call.

Functions

func IsRejected

func IsRejected(err error) bool

IsRejected reports whether err is or wraps a pre-request rejection.

func NewRejectError

func NewRejectError(handlerID, message string) error

NewRejectError returns a stable rejection error for handler decisions.

Types

type Decision

type Decision struct {
	Deny        bool
	DenyMessage string
	Annotations map[string]string
}

Decision is the outcome of one pre-request handler.

func Allow

func Allow() Decision

Allow returns an allow decision.

func Deny

func Deny(message string) Decision

Deny returns a deny decision with a client-safe message.

func (Decision) Allowed

func (d Decision) Allowed() bool

Allowed reports whether the decision allows the call to continue.

type Handler

type Handler interface {
	ID() string
	Order() int
	FailureMode() sdkhooks.FailureMode
	Handle(ctx context.Context, call *lipapi.Call, meta Meta, svc Services) (Decision, error)
}

Handler runs before route planning for the primary model.

func MaterializeSorted

func MaterializeSorted(in []Handler) []Handler

MaterializeSorted returns handlers sorted by Order, ID, and original registration index.

type Meta

type Meta struct {
	TraceID        string
	Annotations    map[string]string
	Principal      execview.PrincipalView
	Scope          scope.PrincipalScopeView
	Session        session.SessionView
	Workspace      workspace.WorkspaceView
	AuxiliaryDepth int
}

Meta is read-only request context for pre-request admission handlers. Scope is the authoritative principal/scope attribution for the accepted request, carried separately from the legacy Principal projection (requirement 2.6). A zero Scope preserves local/anonymous/unknown attribution semantics: SubjectKind is the empty string (the zero SubjectKind) and presence-aware Values remain unknown.

type RejectError

type RejectError struct {
	HandlerID string
	Message   string
}

RejectError carries a deterministic client-safe rejection message.

func (*RejectError) Error

func (e *RejectError) Error() string

func (*RejectError) Unwrap

func (e *RejectError) Unwrap() error

type Services

type Services struct {
	State state.Store
	Aux   auxiliary.Client
}

Services exposes narrow capabilities for pre-request handlers.

Jump to

Keyboard shortcuts

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