middleware

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthUserCtx types.ContextKey = "authUser"
)

Variables

This section is empty.

Functions

func EnsurePeriod

func EnsurePeriod(start time.Time, end time.Time) error

func GetAuthFromRequest

func GetAuthFromRequest(r *http.Request) (*auth.Credential, error)

func GetAuthUserFromContext

func GetAuthUserFromContext(ctx context.Context) *auth.AuthenticatedUser

func GetPageableFromContext

func GetPageableFromContext(ctx context.Context) datastore.Pageable

func InstrumentPath added in v1.1.6

func InstrumentPath(path string) func(http.Handler) http.Handler

func InstrumentRequests added in v1.1.6

func InstrumentRequests() func(next http.Handler) http.Handler

func JsonResponse added in v1.1.6

func JsonResponse(next http.Handler) http.Handler

func LogHttpRequest added in v1.1.6

func LogHttpRequest(a *types.APIOptions) func(next http.Handler) http.Handler

func Pagination added in v1.1.6

func Pagination(next http.Handler) http.Handler

func RequireAuth added in v1.1.6

func RequireAuth() func(next http.Handler) http.Handler

func RequirePersonalAccessToken added in v1.1.6

func RequirePersonalAccessToken() func(next http.Handler) http.Handler

func SetupCORS added in v1.1.6

func SetupCORS(next http.Handler) http.Handler

func WriteRequestIDHeader added in v1.1.6

func WriteRequestIDHeader(next http.Handler) http.Handler

Types

type AuthorizedLogin

type AuthorizedLogin struct {
	Username   string    `json:"username,omitempty"`
	Token      string    `json:"token"`
	ExpiryTime time.Time `json:"expiry_time"`
}

Jump to

Keyboard shortcuts

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