Documentation
¶
Index ¶
- Variables
- type APIContext
- type APIInput
- type APIRequest
- type APIResponse
- type APISubject
- type Component
- func (c *Component) HandleGetBundle(w http.ResponseWriter, r *http.Request)
- func (c *Component) HandleListBundles(w http.ResponseWriter, r *http.Request)
- func (c *Component) HandleMainPolicy(w http.ResponseWriter, r *http.Request)
- func (c *Component) HandlePolicy(w http.ResponseWriter, r *http.Request)
- func (c *Component) RegisterHttpHandlers(publicMux *http.ServeMux, internalMux *http.ServeMux)
- func (c *Component) Start() error
- func (c *Component) Stop(ctx context.Context) error
- type Config
- type FHIRRestData
- type HTTPRequest
- type OtherProps
- type PIPConfig
- type Params
- type PathDef
- type PolicyAction
- type PolicyConsent
- type PolicyContext
- type PolicyInput
- type PolicyResource
- type PolicyResult
- type PolicySubject
- type PolicySubjectClient
- type PolicySubjectOrganization
- type PolicySubjectUser
- type ResultReason
- type Tokens
- type TypeResultCode
Constants ¶
This section is empty.
Variables ¶
View Source
var FS embed.FS
Functions ¶
This section is empty.
Types ¶
type APIContext ¶ added in v0.10.0
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 ¶
type Config ¶
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 OtherProps ¶ added in v0.10.0
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 PolicySubjectOrganization ¶ added in v0.10.0
type PolicySubjectUser ¶ added in v0.10.0
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" )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.