pairs

package
v0.0.0-...-d73d392 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEndpointMapFromResponse

func GetEndpointMapFromResponse(
	respPairs []*Pair,
	methodsInfo map[string]Info,
	mapByResourcePlusAction map[Pair][]string,
	fullyHydrate bool) (map[string]*gwAuthzRes.MethodsAllowed, error)

GetEndpointMapFromResponse returns a map whose keys are HTTP endpoints. The corresponding value is a sub-map of HTTP methods with boolean values indicating whether the user has permission to access that HTTP method on the HTTP endpoint.

func InvertMapNonParameterized

func InvertMapNonParameterized(inputMap map[string]Info) map[Pair][]string

InvertMapNonParameterized reverses the method map with a compound key of resource & action. That allows us to separate the http metadata from the resource/action pair, send the latter off to authz-service for processing, then upon return re-associate them to the one (or more) tuple of http data.

func InvertMapParameterized

func InvertMapParameterized(
	inputMap map[string]Info, path string, paramList []string) (map[Pair][]string, error)

InvertMapParameterized reverses the method map with a compound key of resource & action.

Types

type Info

type Info struct {
	Resource     string
	Action       string
	HTTPMethod   string
	HTTPEndpoint string
}

Info is a container for the metadata for an API method

type Pair

type Pair struct {
	Resource string `json:"resource,omitempty"`
	Action   string `json:"action,omitempty"`
}

Pair is a resource and an action

func GetKeys

func GetKeys(mapByResourcePlusAction map[Pair][]string) []*Pair

GetKeys returns a list of keys of the map.

Jump to

Keyboard shortcuts

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