Documentation ¶
Index ¶
- Variables
- func Auth(_cfg AuthConfig) echo.MiddlewareFuncd
- type AuthConfig
- func (a *AuthConfig) Prepare(ctx echo.Context, mustWithSign bool) (appID string, sign string, err error)
- func (a *AuthConfig) SecretGetter() func(ctx echo.Context, appID string) (string, error)
- func (a *AuthConfig) SetDefaults()
- func (a *AuthConfig) SetSecretGetter(getter func(ctx echo.Context, appID string) (string, error)) *AuthConfig
- func (a *AuthConfig) SetSignMaker(signMaker func(data url.Values, secret string) string) *AuthConfig
- func (a *AuthConfig) SignMaker() func(data url.Values, secret string) string
- func (a *AuthConfig) SignRequest(ctx echo.Context, appID string) (sign string, err error)
- func (a *AuthConfig) Verify(ctx echo.Context) error
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) SecretGetter ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.