pdp

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: EUPL-1.2 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewPolicyInput added in v0.5.0

func NewPolicyInput(request PDPRequest) (PolicyInput, PolicyResult)

Types

type Component

type Component struct {
	Config Config
	// contains filtered or unexported fields
}

func New

func New(config Config, consentChecker mitz.ConsentChecker) (*Component, error)

New creates an instance of the pdp component, which provides a simple policy decision endpoint.

func (*Component) HandleGetBundle added in v0.5.0

func (c *Component) HandleGetBundle(w http.ResponseWriter, r *http.Request)

HandleGetBundle serves an OPA policy bundle for a specific scope

func (*Component) HandleListBundles added in v0.5.0

func (c *Component) HandleListBundles(w http.ResponseWriter, r *http.Request)

HandleListBundles returns a list of available OPA policy bundles

func (*Component) HandleMainPolicy

func (c *Component) HandleMainPolicy(w http.ResponseWriter, r *http.Request)

func (*Component) HandlePolicy

func (c *Component) HandlePolicy(w http.ResponseWriter, r *http.Request)

func (*Component) RegisterHttpHandlers

func (c *Component) RegisterHttpHandlers(publicMux *http.ServeMux, internalMux *http.ServeMux)

func (*Component) Start

func (c *Component) Start() error

func (*Component) Stop

func (c *Component) Stop(ctx context.Context) error

type Config

type Config struct {
	Enabled bool      `koanf:"enabled"`
	PIP     PIPConfig `koanf:"pip"`
}

func DefaultConfig

func DefaultConfig() Config

type FHIRRestData added in v0.6.0

type FHIRRestData struct {
	CapabilityChecked bool                        `json:"capability_checked"`
	Include           []string                    `json:"include"`
	InteractionType   fhir.TypeRestfulInteraction `json:"interaction_type"`
	Operation         *string                     `json:"operation"`
	Revinclude        []string                    `json:"revinclude"`
	SearchParams      map[string]string           `json:"search_params"`
	PatientID         string                      `json:"patient_id"`
}

type HTTPRequest added in v0.5.0

type HTTPRequest struct {
	Method      string      `json:"method"`
	Protocol    string      `json:"protocol"` // "HTTP/1.0"
	Path        string      `json:"path"`
	QueryParams url.Values  `json:"query_params"`
	Header      http.Header `json:"header"`
	Body        string      `json:"body"`
}

type PDPContext added in v0.5.0

type PDPContext struct {
	ConnectionTypeCode       string `json:"connection_type_code"`
	DataHolderFacilityType   string `json:"data_holder_facility_type"`
	DataHolderOrganizationId string `json:"data_holder_organization_id"`
	PatientBSN               string `json:"patient_bsn"`
}

type PDPInput added in v0.5.0

type PDPInput struct {
	Subject Subject     `json:"subject"`
	Request HTTPRequest `json:"request"`
	Context PDPContext  `json:"context"`
}

type PDPRequest added in v0.5.0

type PDPRequest struct {
	Input PDPInput `json:"input"`
}

type PDPResponse added in v0.5.0

type PDPResponse struct {
	Result PolicyResult `json:"result"`
}

type PIPConfig added in v0.5.0

type PIPConfig struct {
	URL string `koanf:"url"`
}

type Params added in v0.5.0

type Params struct {
	SearchParams map[string]string
	Revinclude   []string
	Include      []string
}

type PathDef added in v0.5.0

type PathDef struct {
	Interaction fhir.TypeRestfulInteraction
	PathDef     []string
	Verb        string
}

type PolicyAction added in v0.5.0

type PolicyAction struct {
	Name               string       `json:"name"`
	ConnectionTypeCode string       `json:"connection_type_code"`
	Request            HTTPRequest  `json:"request"`
	FHIRRest           FHIRRestData `json:"fhir_rest"`
}

type PolicyContext added in v0.5.0

type PolicyContext struct {
	DataHolderFacilityType   string `json:"data_holder_facility_type"`
	DataHolderOrganizationId string `json:"data_holder_organization_id"`
	MitzConsent              bool   `json:"mitz_consent"`
	PatientBSN               string `json:"patient_bsn"`
	PurposeOfUse             string `json:"purpose_of_use"`
}

type PolicyInput added in v0.5.0

type PolicyInput struct {
	Subject  Subject        `json:"subject"`
	Resource PolicyResource `json:"resource"`
	Action   PolicyAction   `json:"action"`
	Context  PolicyContext  `json:"context"`
}

type PolicyResource added in v0.5.0

type PolicyResource struct {
	Type       *fhir.ResourceType       `json:"type"`
	Properties PolicyResourceProperties `json:"properties"`
}

type PolicyResourceProperties added in v0.5.0

type PolicyResourceProperties struct {
	ResourceId string `json:"resource_id"`
	VersionId  string `json:"version_id"`
}

type PolicyResult added in v0.4.0

type PolicyResult struct {
	Policy  string         `json:"policy"`
	Allow   bool           `json:"allow"`
	Reasons []ResultReason `json:"reasons"`
}

func Allow added in v0.4.0

func Allow() PolicyResult

Allow helper for creating an allowed result without reasons

func Deny added in v0.4.0

func Deny(reason ResultReason) PolicyResult

Deny Helper for creating a result with a single deny reason

func (*PolicyResult) AddReasons added in v0.5.0

func (p *PolicyResult) AddReasons(input []string, format string, code TypeResultCode)

type ResultReason added in v0.4.0

type ResultReason struct {
	Code        TypeResultCode `json:"code"`
	Description string         `json:"description"`
}

type Subject added in v0.5.0

type Subject struct {
	Type       string            `json:"type"`
	Id         string            `json:"id"`
	Properties SubjectProperties `json:"properties"`
}

type SubjectProperties added in v0.5.0

type SubjectProperties struct {
	ClientId              string   `json:"client_id"`
	ClientQualifications  []string `json:"client_qualifications"`
	SubjectId             string   `json:"subject_id"`
	SubjectOrganizationId string   `json:"subject_organization_id"`
	SubjectOrganization   string   `json:"subject_organization"`
	SubjectFacilityType   string   `json:"subject_facility_type"`
	SubjectRole           string   `json:"subject_role"`
}

type Tokens added in v0.5.0

type Tokens struct {
	Interaction fhir.TypeRestfulInteraction

	ResourceType  *fhir.ResourceType
	ResourceId    string
	OperationName string
	VersionId     string
}

type TypeResultCode added in v0.5.0

type TypeResultCode string
const (
	TypeResultCodeMissingRequiredValue TypeResultCode = "missing_required_value"
	TypeResultCodeUnexpectedInput      TypeResultCode = "unexpected_input"
	TypeResultCodeNotAllowed           TypeResultCode = "not_allowed"
	TypeResultCodeNotImplemented       TypeResultCode = "not_implemented"
	TypeResultCodeInternalError        TypeResultCode = "internal_error"
	TypeResultCodePIPError             TypeResultCode = "pip_error"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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