flow

package
v0.6.2-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStrategyNotResponsible = errors.New("strategy is not responsible for this request")
	ErrCompletedByStrategy    = errors.New("flow response completed by strategy")
)
View Source
var ErrCookieHeaderNeedsBrowserFlow = herodot.ErrBadRequest.
	WithReasonf(`The HTTP Request Header included the "Cookie" key, indicating that this request was made by a Browser. The flow however was initiated as an API request. To prevent potential misuse and mitigate several attack vectors including CSRF, the request has been blocked. Please consult the documentation.`)
View Source
var ErrOriginHeaderNeedsBrowserFlow = herodot.ErrBadRequest.
	WithReasonf(`The HTTP Request Header included the "Origin" key, indicating that this request was made as part of an AJAX request in a Browser. The flow however was initiated as an API request. To prevent potential misuse and mitigate several attack vectors including CSRF, the request has been blocked. Please consult the documentation.`)

Functions

func AppendFlowTo

func AppendFlowTo(src *url.URL, id uuid.UUID) *url.URL

func EnsureCSRF

func EnsureCSRF(
	r *http.Request,
	flowType Type,
	disableAPIFlowEnforcement bool,
	generator func(r *http.Request) string,
	actual string,
) error

func GetFlowID

func GetFlowID(r *http.Request) (uuid.UUID, error)

func MethodEnabledAndAllowed

func MethodEnabledAndAllowed(ctx context.Context, expected, actual string, d interface {
	config.Provider
}) error

func MethodEnabledAndAllowedFromRequest

func MethodEnabledAndAllowedFromRequest(r *http.Request, expected string, d interface {
	config.Provider
}) error

Types

type Flow

type Flow interface {
	GetID() uuid.UUID
	GetType() Type
	GetRequestURL() string
}

type MethodConfigurator

type MethodConfigurator interface {
	container.NodeGetter

	container.ErrorParser

	// form.NodeSetter
	// form.NodeUnsetter
	container.ValueSetter

	container.Resetter
	container.MessageResetter
	container.CSRFSetter
	container.FieldSorter
}

swagger:ignore

type Type

type Type string

Type is the flow type.

The flow type can either be `api` or `browser`.

const (
	TypeAPI     Type = "api"
	TypeBrowser Type = "browser"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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