common

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingScheme        = errors.New("missing `X-Forwarded-Proto`")
	ErrMissingHost          = errors.New("missing `X-Forwarded-Host`")
	ErrMissingRequestMethod = errors.New("missing `X-Forwarded-Method`")
	ErrMissingRequestURI    = errors.New("missing `X-Forwarded-Uri`")
	ErrMissingRealIp        = errors.New("missing `X-Real-Ip`")
)

Functions

func GetIP

func GetIP(forwarded string) (string, error)

Types

type Authenticator

type Authenticator interface {
	CanAuthenticate(request *Request) bool
	Authenticate(request *Request) (*middleware.TumblerClaims, error)
}

type Authorizer

type Authorizer interface {
	Authorize(claims *middleware.TumblerClaims) (*middleware.TumblerClaims, error)
}

type Request

type Request struct {
	ID         string
	Protocol   string
	Host       string
	Method     string
	URI        string
	RemoteAddr string
	Origin     string
	Referer    string
	Header     http.Header
	Cookies    []*http.Cookie

	Original *http.Request

	Organization string
}

func (*Request) Cookie

func (r *Request) Cookie(name string) (*http.Cookie, error)

func (*Request) FromHttpRequest

func (r *Request) FromHttpRequest(req *http.Request) error

func (*Request) LogContext

func (r *Request) LogContext() map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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