middleware

package
v0.0.0-...-ca0f7d1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCheckSearchBotMiddleware

func CreateCheckSearchBotMiddleware(next http.Handler) http.Handler

func GetAccessTokenInfo

func GetAccessTokenInfo(ctx context.Context) *credentials.AccessTokenInfo

func GetClientIP

func GetClientIP(ctx context.Context) string

func GetRefreshToken

func GetRefreshToken(ctx context.Context) *uuid.UUID

func IsTrustedClient

func IsTrustedClient(ctx context.Context) bool

func IsTrustedSearchBot

func IsTrustedSearchBot(ctx context.Context) bool

func RequestID

func RequestID(next http.Handler) http.Handler

RequestID set request ID (UUID V4) into context and headers

func RequireAuth

func RequireAuth(next http.Handler) http.Handler

Types

type Middleware

type Middleware func(next http.Handler) http.Handler

Middleware is chi router middleware type

func CreateAccessLogMiddleware

func CreateAccessLogMiddleware(logger log.Interface) Middleware

CreateAccessLogMiddleware create middleware to log every request

func CreateAccessTokenMiddleware

func CreateAccessTokenMiddleware(sessionGetter sessionGetter, decodeKey string) Middleware

@TODO add logging

func CreateCheckClientMiddleware

func CreateCheckClientMiddleware(needToCheckClient bool) Middleware

func CreateClientIPMiddleware

func CreateClientIPMiddleware(logger log.Interface) Middleware

func CreateCorrectUUIDInParamMiddleware

func CreateCorrectUUIDInParamMiddleware(logger log.Interface, contextKey string, paramName string) Middleware

func CreateRecoverMiddleware

func CreateRecoverMiddleware(logger log.Interface) Middleware

This middleware have to be used only for unexpected errors like "Index is out of range" and so on. Do not panic inside app

func CreateRefreshTokenMiddleware

func CreateRefreshTokenMiddleware(decodeKey string) Middleware

Jump to

Keyboard shortcuts

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