filters

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package filters contains all the http handler chain filters which _are_ api related.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAudit

func WithAudit(handler http.Handler, attributeGetter RequestAttributeGetter, out io.Writer) http.Handler

WithAudit decorates a http.Handler with audit logging information for all the requests coming to the server. If out is nil, no decoration takes place. Each audit log contains two entries: 1. the request line containing:

  • unique id allowing to match the response line (see 2)
  • source ip of the request
  • HTTP method being invoked
  • original user invoking the operation
  • impersonated user for the operation
  • namespace of the request or <none>
  • uri is the full URI as requested

2. the response line containing:

  • the unique id from 1
  • response code

func WithAuthorization

func WithAuthorization(handler http.Handler, getAttribs RequestAttributeGetter, a authorizer.Authorizer) http.Handler

WithAuthorizationCheck passes all authorized requests on to handler, and returns a forbidden error otherwise.

func WithImpersonation

func WithImpersonation(handler http.Handler, requestContextMapper api.RequestContextMapper, a authorizer.Authorizer) http.Handler

WithImpersonation is a filter that will inspect and check requests that attempt to change the user.Info for their requests

func WithRequestInfo

func WithRequestInfo(handler http.Handler, resolver *request.RequestInfoFactory, requestContextMapper api.RequestContextMapper) http.Handler

WithRequestInfo attaches a RequestInfo to the context.

Types

type RequestAttributeGetter

type RequestAttributeGetter interface {
	GetAttribs(req *http.Request) (authorizer.Attributes, error)
}

RequestAttributeGetter is a function that extracts authorizer.Attributes from an http.Request

func NewRequestAttributeGetter

func NewRequestAttributeGetter(requestContextMapper api.RequestContextMapper) RequestAttributeGetter

NewAttributeGetter returns an object which implements the RequestAttributeGetter interface.

Jump to

Keyboard shortcuts

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