http

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderTokenID   = "X-Auth-Id"
	HeaderTokenName = "X-Auth-Name"
	HeaderUserID    = "X-User-Id"
)

Variables

View Source
var (
	ErrUnauthorized = httputil.NewError(http.StatusUnauthorized, "user.not_authorized")
)

Functions

func AuthorizationMiddleware added in v0.0.31

func AuthorizationMiddleware() mux.MiddlewareFunc

func Start

func Start(ctx context.Context, addr string, conf *config.Server, svc domain.CustomerService) error

Start starts the server with specified store.

func TokenIDromContext added in v0.0.31

func TokenIDromContext(ctx context.Context) string

func TokenNameFromContext added in v0.0.31

func TokenNameFromContext(ctx context.Context) string

func UserIDFromContext added in v0.0.31

func UserIDFromContext(ctx context.Context) string

func WithTokenID added in v0.0.31

func WithTokenID(ctx context.Context, id string) context.Context

func WithTokenName added in v0.0.31

func WithTokenName(ctx context.Context, name string) context.Context

func WithUserID added in v0.0.31

func WithUserID(ctx context.Context, id string) context.Context

Types

type HeaderKey added in v0.0.31

type HeaderKey int
const (
	UserIDHeaderKey HeaderKey = iota
	TokenIDHeaderKey
	TokenNameHeaderKey
)

Jump to

Keyboard shortcuts

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