authorizationapi

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package authorizationapi validates the DTQL authorization HTTP ingress. These descriptions carry no authenticated identity or execution authority.

Index

Constants

View Source
const MaxRequestBytes = 1 << 20

Variables

This section is empty.

Functions

func DecodeStrict

func DecodeStrict(data []byte, target any) error

Types

type Change

type Change struct {
	Op    string          `json:"op"`
	Path  []string        `json:"path"`
	Value json.RawMessage `json:"value"`
}

type Mutation

type Mutation struct {
	Data           map[string]any `json:"data,omitempty"`
	Changes        []Change       `json:"changes,omitempty"`
	IfDataRevision string         `json:"ifDataRevision,omitempty"`
}

type Operation

type Operation struct {
	ID             string                       `json:"id"`
	Action         string                       `json:"action"`
	Resource       authorization.Resource       `json:"resource"`
	Query          *Query                       `json:"query,omitempty"`
	Mutation       *Mutation                    `json:"mutation,omitempty"`
	ExecutionClass authorization.ExecutionClass `json:"executionClass"`
	Callable       *authorization.Callable      `json:"callable,omitempty"`
}

func (*Operation) Normalize

func (o *Operation) Normalize(database string) error

Normalize is shared by diagnostic and real execution ingress. It does not execute queries, resolve principals, read rows, or load policy snapshots.

type Query

type Query struct {
	Format     string         `json:"format"`
	Text       string         `json:"text"`
	Parameters map[string]any `json:"parameters,omitempty"`
}

func (Query) Parse

func (q Query) Parse(table string) (dal.StructuredQuery, error)

type Request

type Request struct {
	APIVersion      string               `json:"apiVersion"`
	Mode            authorization.Mode   `json:"mode"`
	DiagnosticLevel string               `json:"diagnosticLevel"`
	Subject         *access.PrincipalRef `json:"subject,omitempty"`
	Simulation      *Simulation          `json:"simulation,omitempty"`
	Operations      []Operation          `json:"operations"`
	Sample          *Sample              `json:"sample,omitempty"`
}

func Parse

func Parse(data []byte, database string) (Request, error)

Parse rejects ambiguous JSON before decoding a closed request. Validation derives redundant resource names and verifies the actual query collection.

func (*Request) Validate

func (r *Request) Validate(database string) error

type Sample

type Sample struct {
	Query Query `json:"query"`
	Limit int   `json:"limit"`
}

type Simulation

type Simulation struct {
	Roles      []string       `json:"roles"`
	Groups     []string       `json:"groups"`
	Attributes map[string]any `json:"attributes"`
}

Jump to

Keyboard shortcuts

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