|
|
package beego
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"github.com/beego/beego/v2/server/web/context"
|
|
|
"os"
|
|
|
"strconv"
|
|
|
|
...
|
...
|
@@ -30,4 +32,11 @@ func init() { |
|
|
web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors())
|
|
|
web.InsertFilter("/*", web.BeforeExec, filters.CreateRequstLogFilter(log.Logger))
|
|
|
web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(log.Logger), web.WithReturnOnOutput(false))
|
|
|
web.InsertFilter("/v1/app1/*", web.BeforeExec, filters.SecureHandler(
|
|
|
filters.WithEnableCheckTimestamp(false),
|
|
|
filters.WithOnInvalidRequest(func(ctx *context.Context) {
|
|
|
headerData, _ := json.Marshal(ctx.Input.Context.Request.Header)
|
|
|
log.Logger.Info("签名验证失败:" + string(headerData))
|
|
|
}),
|
|
|
))
|
|
|
} |
...
|
...
|
|