Documentation
¶
Overview ¶
Package operation carries the transport-independent authorization contract attached by every network adapter before it invokes a service operation.
Index ¶
- Constants
- func AdmitPreauthentication(ctx context.Context) error
- func AdmitRequest(ctx context.Context, sessionID string) error
- func AdmitSessionPresentation(ctx context.Context, verifier []byte) error
- func ForgetSession(ctx context.Context, verifier []byte)
- func IsNetwork(ctx context.Context) bool
- func NoteSessionLive(ctx context.Context, verifier []byte, sessionID string)
- func WithContract(ctx context.Context, contract Contract) context.Context
- func WithLiveSessions(ctx context.Context, sessions LiveSessions) context.Context
- func WithNetwork(ctx context.Context) context.Context
- func WithPreauthenticationAdmission(ctx context.Context, charge func() error) context.Context
- func WithRequestAdmission(ctx context.Context, charge func(sessionID string) error) context.Context
- type Contract
- type LiveSessions
Constants ¶
const ( ArtifactNone = "none" ArtifactHumanSession = "human-session" ArtifactMachineCredential = "machine-credential" ArtifactDeveloperCredential = "developer-credential" ArtifactSCIMCredential = "scim-credential" ArtifactInstanceCredential = "instance-credential" ArtifactLocal = "local" )
Variables ¶
This section is empty.
Functions ¶
func AdmitPreauthentication ¶
AdmitPreauthentication bounds artifact resolution before its first datastore read. Call after cheap grammar checks, independently of credential liveness. Source identity comes from transport middleware, not tokens. Nested reads and retries reuse the admission outcome, including a refusal.
func AdmitRequest ¶
AdmitRequest charges only a human session proven live, by this transaction or by an earlier one on this node. Invalid credentials and machine callers cannot allocate or spend human buckets.
func AdmitSessionPresentation ¶
AdmitSessionPresentation bounds a session artifact's reads. A session known live spends its request budget; anything else spends the source allowance, unless this request already paid for that verifier. Either is spent before the first read. A session that died while known keeps spending its budget until one resolution finds it dead and forgets it.
func ForgetSession ¶
ForgetSession records that resolution found the session dead, so its next presentation is charged to the source again. A fault proves nothing, and the session's budget bounds any retries, so a fault leaves the memory alone.
func NoteSessionLive ¶
NoteSessionLive records that resolution proved the session live.
func WithContract ¶
WithContract attaches a trusted operation contract to a network request.
func WithLiveSessions ¶
func WithLiveSessions(ctx context.Context, sessions LiveSessions) context.Context
WithLiveSessions moves a proven session from the source allowance, which bounds credential guessing, to its own request budget.
func WithNetwork ¶
WithNetwork marks work entered through a network adapter, including public metadata operations that have no authorization contract.
func WithPreauthenticationAdmission ¶
WithPreauthenticationAdmission attaches trusted source admission to one request. Nested reads and transaction retries share accounting, never an authentication or authorization result.
func WithRequestAdmission ¶
WithRequestAdmission attaches accounting, not identity or authorization, to one network request. Transaction retries and nested service reads share the receipt; authentication is still resolved live before every admission.
Types ¶
type Contract ¶
type Contract struct {
ID string
AuthorizationOperation string
// contains filtered or unexported fields
}
Contract is one immutable network-operation admission row. It is built from trusted compiled registry data, never request input.
func FromContext ¶
FromContext returns the network operation contract, when one was attached.
func NewArtifactContract ¶
NewArtifactContract constructs an immutable admission row for a network operation that has an artifact policy but no domain authorization formula.
func NewContract ¶
NewContract constructs a complete immutable operation contract.
func (Contract) AdmitsArtifact ¶
AdmitsArtifact reports whether class is explicitly admitted.
type LiveSessions ¶
type LiveSessions interface {
KnownLiveSession(verifier []byte) (sessionID string, known bool)
NoteLiveSession(verifier []byte, sessionID string)
ForgetSession(verifier []byte)
}
LiveSessions is one node's memory of the sessions it has proven live. It decides only which limit a presentation spends, never whether it is accepted.