pdp

package
v0.10.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type APIContext added in v0.10.0

type APIContext 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 APIInput added in v0.10.0

type APIInput struct {
	Subject APISubject  `json:"subject"`
	Request HTTPRequest `json:"request"`
	Context APIContext  `json:"context"`
}

type APIRequest added in v0.10.0

type APIRequest struct {
	Input APIInput `json:"input"`
}

type APIResponse added in v0.10.0

type APIResponse struct {
	Allow bool `json:"allow"`
	// Error is an optional field that can be used to provide additional information about why a decision couldn't be made.
	// This is intended for informational purposes and should not be used to determine the outcome of the decision (i.e. allow/deny).
	Error    string                  `json:"error,omitempty"`
	Policies map[string]PolicyResult `json:"policies"`
}

type APISubject added in v0.10.0

type APISubject struct {
	OtherProps               map[string]any `json:"-"`
	Active                   bool           `json:"active"`
	ClientId                 string         `json:"client_id"`
	Scope                    string         `json:"scope"`
	UserId                   string         `json:"user_id"`
	UserRole                 string         `json:"user_role"`
	OrganizationUra          string         `json:"organization_ura"`
	OrganizationName         string         `json:"organization_name"`
	OrganizationFacilityType string         `json:"organization_facility_type"`
}

func (APISubject) MarshalJSON added in v0.10.0

func (s APISubject) MarshalJSON() ([]byte, error)

func (*APISubject) UnmarshalJSON added in v0.10.0

func (s *APISubject) UnmarshalJSON(data []byte) error

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"`
}

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 OtherProps added in v0.10.0

type OtherProps map[string]any

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 PolicyConsent added in v0.10.0

type PolicyConsent struct {
	Scope string `json:"scope"`
}

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"`
	PatientID                string `json:"patient_id"`
	PurposeOfUse             string `json:"purpose_of_use"`
}

type PolicyInput added in v0.5.0

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

func NewPolicyInput added in v0.5.0

func NewPolicyInput(request APIRequest) (*PolicyInput, error)

func (PolicyInput) Copy added in v0.10.0

func (p PolicyInput) Copy() PolicyInput

type PolicyResource added in v0.5.0

type PolicyResource struct {
	Id        string             `json:"id"`
	Type      *fhir.ResourceType `json:"type"`
	VersionId string             `json:"version_id"`
	Consents  []PolicyConsent    `json:"consents"`
}

type PolicyResult added in v0.4.0

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

type PolicySubject added in v0.10.0

type PolicySubject struct {
	OtherProps   `json:"-"`
	Client       PolicySubjectClient       `json:"client"`
	Organization PolicySubjectOrganization `json:"organization"`
	User         PolicySubjectUser         `json:"user"`
}

func NewPolicySubject added in v0.10.0

func NewPolicySubject(apiSubject APISubject) PolicySubject

func (PolicySubject) MarshalJSON added in v0.10.0

func (s PolicySubject) MarshalJSON() ([]byte, error)

type PolicySubjectClient added in v0.10.0

type PolicySubjectClient struct {
	Id     string   `json:"id"`
	Scopes []string `json:"scopes"`
}

type PolicySubjectOrganization added in v0.10.0

type PolicySubjectOrganization struct {
	Ura          string `json:"ura"`
	Name         string `json:"name"`
	FacilityType string `json:"facility_type"`
}

type PolicySubjectUser added in v0.10.0

type PolicySubjectUser struct {
	Id   string `json:"id"`
	Role string `json:"role"`
}

type ResultReason added in v0.4.0

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

func (ResultReason) String added in v0.7.0

func (r ResultReason) String() string

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 (
	TypeResultCodeUnexpectedInput TypeResultCode = "unexpected_input"
	TypeResultCodeNotAllowed      TypeResultCode = "not_allowed"
	TypeResultCodeNotImplemented  TypeResultCode = "not_implemented"
	TypeResultCodeInternalError   TypeResultCode = "internal_error"
	TypeResultCodePIPError        TypeResultCode = "pip_error"
	TypeResultCodeInformational   TypeResultCode = "info"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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