mwapp

package
v0.0.0-...-dd75de5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAuthAppConfig = AuthConfig{
		HeaderAppIDKey: `X-App-ID`,
		HeaderSignKey:  `X-App-Sign`,
		HeaderTimeKey:  `X-App-Timestamp`,
		FormAppIDKey:   `appID`,
		FormSignKey:    `sign`,
		FormTimeKey:    `timestamp`,
		LifeSeconds:    3600,
		// contains filtered or unexported fields
	}
)

Functions

func Auth

func Auth(_cfg AuthConfig) echo.MiddlewareFuncd

Types

type AuthConfig

type AuthConfig struct {
	// Header 字段名
	HeaderAppIDKey string
	HeaderSignKey  string
	HeaderTimeKey  string
	// Form 字段名
	FormAppIDKey string
	FormSignKey  string
	FormTimeKey  string
	// 有效期
	LifeSeconds int64
	// contains filtered or unexported fields
}

func NewAuthConfig

func NewAuthConfig() *AuthConfig

func (*AuthConfig) Prepare

func (a *AuthConfig) Prepare(ctx echo.Context, mustWithSign bool) (appID string, sign string, err error)

func (*AuthConfig) SecretGetter

func (a *AuthConfig) SecretGetter() func(ctx echo.Context, appID string) (string, error)

func (*AuthConfig) SetDefaults

func (a *AuthConfig) SetDefaults()

func (*AuthConfig) SetSecretGetter

func (a *AuthConfig) SetSecretGetter(getter func(ctx echo.Context, appID string) (string, error)) *AuthConfig

func (*AuthConfig) SetSignMaker

func (a *AuthConfig) SetSignMaker(signMaker func(data url.Values, secret string) string) *AuthConfig

func (*AuthConfig) SignMaker

func (a *AuthConfig) SignMaker() func(data url.Values, secret string) string

func (*AuthConfig) SignRequest

func (a *AuthConfig) SignRequest(ctx echo.Context, appID string) (sign string, err error)

func (*AuthConfig) Verify

func (a *AuthConfig) Verify(ctx echo.Context) error

Jump to

Keyboard shortcuts

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