middleware

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JWTContextKey = JWTContextKeyType("jwt")
)

Functions

func CORS

func CORS(next http.Handler) http.Handler

func RequestsCounterMiddleware

func RequestsCounterMiddleware() mux.MiddlewareFunc

Types

type AccountAuthorizationMiddlewareClient

type AccountAuthorizationMiddlewareClient struct {
	// contains filtered or unexported fields
}

func NewAccountAuthorizationMiddleware

func NewAccountAuthorizationMiddleware(logger *zap.Logger) *AccountAuthorizationMiddlewareClient

func (*AccountAuthorizationMiddlewareClient) IsAccountAuthorized

func (aa *AccountAuthorizationMiddlewareClient) IsAccountAuthorized(next http.Handler) http.Handler

type JWT

type JWT struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Picture  string `json:"picture"`
	Role     string `json:"role"`
	Sub      string `json:"sub"`
	ID       string `json:"id"`
	Provider string `json:"provider"`
	Iat      int    `json:"iat"`
	Exp      int    `json:"exp"`
	Jti      string `json:"jti"`
}

func GetJWTFromRequestContext

func GetJWTFromRequestContext(r *http.Request) (*JWT, error)

type JWTContextKeyType

type JWTContextKeyType string

type JWTMiddlewareClient

type JWTMiddlewareClient struct {
	// contains filtered or unexported fields
}

func NewJWTMiddleware

func NewJWTMiddleware(logger *zap.Logger, secret string) (*JWTMiddlewareClient, error)

func (*JWTMiddlewareClient) JWTMiddleware

func (jwtmc *JWTMiddlewareClient) JWTMiddleware(next http.Handler) http.Handler

type MiddlewareExemption

type MiddlewareExemption struct {
	Path   string
	Method string
}

Jump to

Keyboard shortcuts

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