decisionsupportproviders

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

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) (any interface{}, err error)

type HTTPClient

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

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) (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) BuildInput

func (o OpaDecisionProvider) BuildInput(r *http.Request) (any interface{}, err error)

type OpaQuery

type OpaQuery struct {
	Input map[string]interface{} `json:"input"`
}

type OpaResponse

type OpaResponse struct {
	Result bool
}

Jump to

Keyboard shortcuts

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