middleware

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthentication

func NewAuthentication(hctx http2.HttpHandlerContext, authOption AuthOption) func(next http.Handler) http.Handler

Middleware authentication supports jwt or basic auth

func NewBasicAuth

func NewBasicAuth(hctx http2.HttpHandlerContext, definedUsername, definedPassword string) func(next http.Handler) http.Handler

func NewHeaderCheck

func NewHeaderCheck(hctx http2.HttpHandlerContext, secretKey string) func(next http.Handler) http.Handler

func NewJWT

func NewJWT(hctx http2.HttpHandlerContext, signKey []byte) func(next http.Handler) http.Handler

func NewPaseto

func NewPaseto(hctx http2.HttpHandlerContext, publicKey string) func(next http.Handler) http.Handler

Types

type AuthOption

type AuthOption struct {
	SignKey  []byte // jwt sign key
	Username string // Basic Auth username
	Password string // Basuc Auth password
}

type ConfigOpts

type ConfigOpts func(s *http2.PerkakasHttpHandler)
type Header struct {
	XKtbsRequestID     string `valid:"uuidv4,required"`
	XKtbsAPIVersion    string `valid:"semver,required"`
	XKtbsClientVersion string `valid:"semver,required"`
	XKtbsPlatformName  string `valid:"required"`
	XKtbsClientName    string `valid:"required"`

	// Optional
	XKtbsSignature string `valid:"optional"`
	XKtbsTime      string `valid:"int,optional"`
	Authorization  string `valid:"optional"`
}

Jump to

Keyboard shortcuts

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