handler

package
v2.0.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// The Content-Type value for JSON
	JsonContentType string = "application/json; charset=UTF-8"

	// The Content-Type header
	ContentTypeHeader string = "Content-Type"

	// The X-Content-Type-Options header
	ContentTypeOptionsHeader string = "X-Content-Type-Options"

	// NoSniff is the value used for content options for errors written by this package
	NoSniff string = "nosniff"
)

Variables

This section is empty.

Functions

func NewContextWithValue

func NewContextWithValue(ctx context.Context, vals *ContextValues) context.Context

NewContextWithValue returns a context with the specified context values

Types

type AuthorizationHandler

type AuthorizationHandler struct {
	HeaderName          string
	ForbiddenStatusCode int
	Validator           secure.Validator
	Logger              log.Logger
	// contains filtered or unexported fields
}

AuthorizationHandler provides decoration for http.Handler instances and will ensure that requests pass the validator. Note that secure.Validators is a Validator implementation that allows chaining validators together via logical OR.

func (AuthorizationHandler) Decorate

func (a AuthorizationHandler) Decorate(delegate http.Handler) http.Handler

Decorate provides an Alice-compatible constructor that validates requests using the configuration specified.

func (*AuthorizationHandler) DefineMeasures

func (a *AuthorizationHandler) DefineMeasures(m *secure.JWTValidationMeasures)

DefineMeasures facilitates clients to define authHandler metrics tools

type ContextValues

type ContextValues struct {
	SatClientID string
	Method      string
	Path        string
	PartnerIDs  []string
	Trust       string
}

ContextValues contains the values shared under the satClientIDKey from this package

func FromContext

func FromContext(ctx context.Context) (*ContextValues, bool)

FromContext returns ContextValues type (if any) along with a boolean that indicates whether the returned value is of the required/correct type for this package.

Jump to

Keyboard shortcuts

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