service

package
v1.12.4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const BASE_ROW_FILTER_HEADER_KEY = "acl_rows"
View Source
const BINDINGS_MAX_PAGE_SIZE = 200

TODO: handle pagination!

View Source
const URL_SCHEME = "http"

Variables

View Source
var (
	ErrUnexepectedContentType          = fmt.Errorf("unexpected content type")
	ErrOPATransportInvalidResponseBody = fmt.Errorf("response body is not valid")
)
View Source
var (
	ErrSDKNotReadyMessage         = "service not ready to work yet"
	ErrSDKNotReadyBusinessMessage = "the service is not ready to work yet, try again in a few moments"
)

Functions

func EvaluateRequest

func EvaluateRequest(
	req *http.Request,
	env config.EnvironmentVariables,
	w http.ResponseWriter,
	evaluatorSdk sdk.Evaluator,
	rondInputUser core.InputUser,
) error

func OPAMiddleware added in v1.9.0

func OPAMiddleware(
	opaModuleConfig *core.OPAModuleConfig,
	sdkState *SDKBootState,
	routesToNotProxy []string,
	targetServiceOASPath string,
	options *OPAMiddlewareOptions,
) mux.MiddlewareFunc

func ReverseProxy

func ReverseProxy(
	logger *logrus.Entry,
	env config.EnvironmentVariables,
	w http.ResponseWriter,
	req *http.Request,
	permission *core.RondConfig,
	evaluatorSdk sdk.Evaluator,
	inputUser core.InputUser,
)

func ReverseProxyOrResponse

func ReverseProxyOrResponse(
	logger *logrus.Entry,
	env config.EnvironmentVariables,
	w http.ResponseWriter,
	req *http.Request,
	evaluatorSdk sdk.Evaluator,
	inputUser core.InputUser,
)

func SetupRouter

func SetupRouter(
	log *logrus.Logger,
	env config.EnvironmentVariables,
	opaModuleConfig *core.OPAModuleConfig,
	oas *openapi.OpenAPISpec,
	sdkBoot *SDKBootState,
	inputUserClient inputuser.Client,
	registry *prometheus.Registry,
) (*mux.Router, error)

func StatusRoutes

func StatusRoutes(r *mux.Router, sdkBoot *SDKBootState, serviceName, serviceVersion string)

StatusRoutes add status routes to router.

Types

type GrantRequestBody

type GrantRequestBody struct {
	ResourceID  string   `json:"resourceId"`
	Subjects    []string `json:"subjects"`
	Groups      []string `json:"groups"`
	Roles       []string `json:"roles"`
	Permissions []string `json:"permissions"`
}

type GrantResponseBody

type GrantResponseBody struct {
	BindingID string `json:"bindingId"`
}

type OPAMiddlewareOptions added in v1.9.0

type OPAMiddlewareOptions struct {
	IsStandalone         bool
	PathPrefixStandalone string
}

type OPATransport added in v1.9.0

type OPATransport struct {
	http.RoundTripper
	// contains filtered or unexported fields
}

func NewOPATransport added in v1.9.0

func NewOPATransport(
	transport http.RoundTripper,
	context context.Context,
	config *core.RondConfig,
	logger *logrus.Entry,
	req *http.Request,
	clientHeaderKey string,
	user core.InputUser,
	evaluatorSDK sdk.Evaluator,
) *OPATransport

func (*OPATransport) RoundTrip added in v1.9.0

func (t *OPATransport) RoundTrip(req *http.Request) (resp *http.Response, err error)

type RevokeRequestBody

type RevokeRequestBody struct {
	Subjects    []string `json:"subjects,omitempty"`
	Groups      []string `json:"groups,omitempty"`
	ResourceIDs []string `json:"resourceIds"`
}

type RevokeResponseBody

type RevokeResponseBody struct {
	DeletedBindings  int `json:"deletedBindings"`
	ModifiedBindings int `json:"modifiedBindings"`
}

type SDKBootState added in v1.11.0

type SDKBootState struct {
	// contains filtered or unexported fields
}

func NewSDKBootState added in v1.11.0

func NewSDKBootState() *SDKBootState

func (*SDKBootState) Get added in v1.11.0

func (*SDKBootState) Ready added in v1.11.0

func (s *SDKBootState) Ready(rond sdk.OASEvaluatorFinder)

type StatusResponse

type StatusResponse struct {
	Status  string `json:"status"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

StatusResponse type.

Jump to

Keyboard shortcuts

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