decisionsupportproviders

package
v0.65.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

Decision Support Providers

This directory contains providers for the DecisionSupport package which is a middleware package that can be used to call HexaOpa servers.

Documentation

Index

Constants

View Source
const EnvOpaDebug string = "HEXAOPA_DETAIL"

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultProvider

type DefaultProvider struct {
}

func (DefaultProvider) Allow

func (d DefaultProvider) Allow(_ interface{}) (bool, error)

func (DefaultProvider) BuildInput

func (d DefaultProvider) BuildInput(_ *http.Request, _ []string, _ []string) (any interface{}, err error)

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type HexaOpaResult added in v0.65.0

type HexaOpaResult struct {
	ActionRights      []string          `json:"action_rights"`
	AllowSet          []string          `json:"allow_set"`
	Allow             bool              `json:"allow"`
	PoliciesEvaluated int               `json:"policies_evaluated"`
	HexaRegoVersion   string            `json:"hexa_rego_version"`
	Scopes            []ScopeObligation `json:"scopes"`
}

type MockDecisionProvider

type MockDecisionProvider struct {
	mock.Mock
	BuildErr error
	Decision bool
	AllowErr error
}

func (*MockDecisionProvider) Allow

func (m *MockDecisionProvider) Allow(_ interface{}) (bool, error)

func (*MockDecisionProvider) BuildInput

func (m *MockDecisionProvider) BuildInput(r *http.Request, _ []string, _ []string) (interface{}, error)

type OpaDecisionProvider

type OpaDecisionProvider struct {
	Client    HTTPClient
	Url       string
	Principal string
}

func (OpaDecisionProvider) Allow

func (o OpaDecisionProvider) Allow(any interface{}) (bool, error)

func (OpaDecisionProvider) AllowQuery added in v0.65.0

func (o OpaDecisionProvider) AllowQuery(any interface{}) (*HexaOpaResult, error)

func (OpaDecisionProvider) BuildInput

func (o OpaDecisionProvider) BuildInput(r *http.Request, actionUris []string, resourceUris []string) (any interface{}, err error)

type OpaResponse

type OpaResponse struct {
	DecisionId  string           `json:"decision_id"`
	Result      HexaOpaResult    `json:"result"`
	Warning     *json.RawMessage `json:"warning"`
	Explanation *json.RawMessage `json:"explanation"`
}

type OpaRestQuery added in v0.65.0

type OpaRestQuery struct {
	Input opaTools.OpaInfo `json:"input"`
}

type ScopeObligation added in v0.65.0

type ScopeObligation struct {
	PolicyID string               `json:"policyId"`
	Scope    hexapolicy.ScopeInfo `json:"scope"`
}

Jump to

Keyboard shortcuts

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