Documentation
¶
Overview ¶
Package api declares Datly 1.0 components that are the authz SDK endpoints.
Index ¶
- Constants
- Variables
- func LinkedRegistrations(services *Services, codecs xcodec.Factory) ([]*registry.RegisteredComponent, error)
- func NewCatalog() xhandler.Contract[CatalogInput, CatalogOutput]
- func NewCheck() xhandler.Contract[CheckInput, DecisionOutput]
- func NewCreate() xhandler.Contract[WriteInput, PolicyOutput]
- func NewGateCheck() xhandler.Contract[GateCheckInput, GateDecisionOutput]
- func NewGateContext() xhandler.Contract[GateInput, GateContextOutput]
- func NewGateGet() xhandler.Contract[GateInput, GateDocumentOutput]
- func NewGateReplace() xhandler.Contract[GateWriteInput, GateDocumentOutput]
- func NewGet() xhandler.Contract[PolicyInput, PolicyOutput]
- func NewPolicyContext() xhandler.Contract[PolicyInput, PolicyContextOutput]
- func NewReplace() xhandler.Contract[WriteInput, PolicyOutput]
- func Registrations(ctx context.Context, baseDir string, services *Services, codecs xcodec.Factory) ([]*registry.RegisteredComponent, error)
- type CatalogAdmission
- type CatalogEntry
- type CatalogFunc
- type CatalogInput
- type CatalogOutput
- type CatalogProvider
- type CheckInput
- type Components
- type DecisionOutput
- type GateCheckInput
- type GateContextOutput
- type GateDecisionOutput
- type GateDocumentOutput
- type GateInput
- type GateWriteInput
- type PolicyContextOutput
- type PolicyInput
- type PolicyOutput
- type Services
- type WriteInput
Constants ¶
const Capability = xhandler.ValueKey("authz.sdk")
const Package = "github.com/viant/authz/component/api"
Variables ¶
var Datly = new(Components)
Functions ¶
func LinkedRegistrations ¶
func LinkedRegistrations(services *Services, codecs xcodec.Factory) ([]*registry.RegisteredComponent, error)
LinkedRegistrations builds the same SDK routes from the linked component holder. Embedding binaries can mount authz without shipping this module's Go source tree. The holder's typed fields and tags remain the route authority.
func NewCatalog ¶
func NewCatalog() xhandler.Contract[CatalogInput, CatalogOutput]
func NewCheck ¶
func NewCheck() xhandler.Contract[CheckInput, DecisionOutput]
func NewCreate ¶
func NewCreate() xhandler.Contract[WriteInput, PolicyOutput]
func NewGateCheck ¶
func NewGateCheck() xhandler.Contract[GateCheckInput, GateDecisionOutput]
func NewGateContext ¶
func NewGateContext() xhandler.Contract[GateInput, GateContextOutput]
func NewGateGet ¶
func NewGateGet() xhandler.Contract[GateInput, GateDocumentOutput]
func NewGateReplace ¶
func NewGateReplace() xhandler.Contract[GateWriteInput, GateDocumentOutput]
func NewGet ¶
func NewGet() xhandler.Contract[PolicyInput, PolicyOutput]
func NewPolicyContext ¶
func NewPolicyContext() xhandler.Contract[PolicyInput, PolicyContextOutput]
func NewReplace ¶
func NewReplace() xhandler.Contract[WriteInput, PolicyOutput]
func Registrations ¶
func Registrations(ctx context.Context, baseDir string, services *Services, codecs xcodec.Factory) ([]*registry.RegisteredComponent, error)
Registrations discovers the declared SDK components using native Datly bootstrap. The host supplies its verifier and narrow authz capabilities. Other projects can use these same components in their own runtime.
Types ¶
type CatalogAdmission ¶
type CatalogAdmission func(context.Context, gating.Principal, CatalogEntry) (handled bool, allowed bool, err error)
CatalogAdmission may handle a host-owned entry whose authority is not a standalone ACL document (for example an inherited logical resource). Unhandled entries keep the ordinary shared viewAccess policy check.
type CatalogEntry ¶
type CatalogEntry struct {
Name string `json:"name"`
Resource authz.Resource `json:"resource"`
Actions []string `json:"actions"`
GateActions []string `json:"gateActions,omitempty"`
// Target is an optional server-authored selection hint for a host editor.
// It conveys no identity or allow decision; the target service reauthorizes.
Target map[string]string `json:"target,omitempty"`
// Context is supplied by the trusted catalog provider for an optional
// host admission check. It is never serialized to HTTP/MCP clients.
Context any `json:"-"`
}
CatalogEntry is a host-authored resource and action choice. The SDK checks viewAccess before returning it; the entry itself is never a grant.
func ListAuthorizedCatalog ¶
func ListAuthorizedCatalog(ctx context.Context, services *Services) ([]CatalogEntry, error)
ListAuthorizedCatalog applies one verified principal and exact policy revisions to a trusted host inventory. Hosts may reuse it for their local editor route and MCP SDK so both surfaces expose identical choices.
type CatalogFunc ¶
type CatalogFunc func(context.Context) ([]CatalogEntry, error)
func (CatalogFunc) List ¶
func (f CatalogFunc) List(ctx context.Context) ([]CatalogEntry, error)
type CatalogInput ¶
type CatalogOutput ¶
type CatalogOutput struct {
Resources []CatalogEntry `json:"resources"`
}
type CatalogProvider ¶
type CatalogProvider interface {
List(context.Context) ([]CatalogEntry, error)
}
type CheckInput ¶
type CheckInput struct {
JWT *jwt.Claims `parameter:"JWT,kind=header,in=Authorization,dataType=string" codec:"JwtClaim" json:"-"`
Resource authz.Resource `parameter:"Resource,kind=body,in=resource,required=true" json:"resource"`
Action string `parameter:"Action,kind=body,in=action,required=true" json:"action"`
Selection *[]authz.Entity `parameter:"Selection,kind=body,in=selection" json:"selection,omitempty"`
}
type Components ¶
type Components struct {
Catalog xdatly.Component[CatalogInput, CatalogOutput] `` /* 151-byte string literal not displayed */
Check xdatly.Component[CheckInput, DecisionOutput] `` /* 156-byte string literal not displayed */
Get xdatly.Component[PolicyInput, PolicyOutput] `` /* 145-byte string literal not displayed */
Context xdatly.Component[PolicyInput, PolicyContextOutput] `` /* 167-byte string literal not displayed */
Create xdatly.Component[WriteInput, PolicyOutput] `` /* 157-byte string literal not displayed */
Replace xdatly.Component[WriteInput, PolicyOutput] `` /* 161-byte string literal not displayed */
GateCheck xdatly.Component[GateCheckInput, GateDecisionOutput] `` /* 149-byte string literal not displayed */
GateGet xdatly.Component[GateInput, GateDocumentOutput] `` /* 141-byte string literal not displayed */
GateContext xdatly.Component[GateInput, GateContextOutput] `` /* 157-byte string literal not displayed */
GateReplace xdatly.Component[GateWriteInput, GateDocumentOutput] `` /* 157-byte string literal not displayed */
}
func (Components) DatlyHandler ¶
func (Components) DatlyHandler(name string) func() (rhandler.TypedHandler, error)
type DecisionOutput ¶
type GateCheckInput ¶
type GateCheckInput struct {
JWT *jwt.Claims `parameter:"JWT,kind=header,in=Authorization,dataType=string" codec:"JwtClaim" json:"-"`
Resource authz.Resource `parameter:"Resource,kind=body,in=resource,required=true" json:"resource"`
Action string `parameter:"Action,kind=body,in=action,required=true" json:"action"`
Selected []authz.Entity `parameter:"Selected,kind=body,in=selected" json:"selected,omitempty"`
}
type GateContextOutput ¶
type GateContextOutput struct {
Context gating.EditorContext `json:"context"`
}
type GateDecisionOutput ¶
type GateDocumentOutput ¶
type GateDocumentOutput struct {
Document gating.RequirementsDocument `json:"document"`
}
type GateInput ¶
type GateInput struct {
JWT *jwt.Claims `parameter:"JWT,kind=header,in=Authorization,dataType=string" codec:"JwtClaim" json:"-"`
Resource authz.Resource `parameter:"Resource,kind=body,in=resource,required=true" json:"resource"`
Action string `parameter:"Action,kind=body,in=action,required=true" json:"action"`
}
type GateWriteInput ¶
type GateWriteInput struct {
JWT *jwt.Claims `parameter:"JWT,kind=header,in=Authorization,dataType=string" codec:"JwtClaim" json:"-"`
Resource authz.Resource `parameter:"Resource,kind=body,in=resource,required=true" json:"resource"`
Action string `parameter:"Action,kind=body,in=action,required=true" json:"action"`
ExpectedRevision string `parameter:"ExpectedRevision,kind=body,in=expectedRevision,required=true" json:"expectedRevision"`
Requirements gating.Requirements `parameter:"Requirements,kind=body,in=requirements,required=true" json:"requirements"`
}
type PolicyContextOutput ¶
type PolicyContextOutput struct {
Context authz.EditorContext `json:"context"`
}
type PolicyInput ¶
type PolicyOutput ¶
type Services ¶
type Services struct {
Authorization *authz.Service
Policies *authz.Administration
Gates *gating.Evaluator
Requirements *gating.Administration
Catalog CatalogProvider
CatalogAdmission CatalogAdmission
}