middleware

package
v0.0.0-...-20989ac Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

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

func NewAuthorizer

func NewAuthorizer(enforcer enforcer.Enforcer, pathPrefix string) (*Authorizer, error)

NewAuthorizer initialises the Turing specific policies on the given auth enforcer and creates a new authorization middleware.

func (*Authorizer) FilterAuthorizedProjects

func (a *Authorizer) FilterAuthorizedProjects(
	user string,
	projects []mlp.Project,
	action string,
) ([]mlp.Project, error)

func (*Authorizer) Middleware

func (a *Authorizer) Middleware(next http.Handler) http.Handler

type OpenAPIValidation

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

OpenAPIValidation middleware validates HTTP requests against OpenAPI spec.

func NewOpenAPIValidation

func NewOpenAPIValidation(
	openAPISpecBytes []byte,
	options OpenAPIValidationOptions,
) (*OpenAPIValidation, error)

NewOpenAPIValidation creates OpenAPIValidation object from OAS3 spec file and provided options

func (*OpenAPIValidation) Middleware

func (openapi *OpenAPIValidation) Middleware(next http.Handler) http.Handler

Middleware returns a middleware function

func (*OpenAPIValidation) Validate

func (openapi *OpenAPIValidation) Validate(r *http.Request) error

Validate the request against the OpenAPI spec

type OpenAPIValidationOptions

type OpenAPIValidationOptions struct {
	// If true, ignore "security" in openapi.yaml.
	IgnoreAuthentication bool
	// If true, ignore "server" declarations in openapi.yaml when validating requests paths. Only consider the paths
	// relative to the server url versus checking the full paths (which include the server URL) in the requests.
	IgnoreServers bool
	// Must be set to path prefix, where API is deployed. E.g. "/v1"
	APIPrefix string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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