Documentation ¶
Index ¶
- func Authorization(req *http.Request, author string, body []byte) error
- func CheckAuthorization(ctx iris.Context) error
- func E(ctx iris.Context, status int, data interface{})
- func Echo(ctx iris.Context, status int, data interface{}, msg string)
- func New() iris.Handler
- func Succ(ctx iris.Context, data interface{})
- type AccessLogger
- type Response
- type SignatureHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authorization ¶
Authorization 向http请求中添加授权数据
func CheckAuthorization ¶
func CheckAuthorization(ctx iris.Context) error
CheckAuthorization 检查请求中的授权数据 服务器通用的相互调用授权机制,在授权中指定授权者名称,时间戳和签名 如果被调用的服务有配置授权者的公钥,并且验签通过,则允许此次调用 签名方法为把时间戳拼接至请求正文最后,然后签名 如果时间戳超过服务器当前事件24小时以上,则调用失败
Types ¶
type AccessLogger ¶
type AccessLogger struct {
// contains filtered or unexported fields
}
AccessLogger 访问日志工具
func NewLogger ¶
func NewLogger(file string) *AccessLogger
NewLogger creates and returns a new access logger
func (*AccessLogger) ServeHTTP ¶
func (l *AccessLogger) ServeHTTP(ctx iris.Context)
Serve serves the middleware
func (*AccessLogger) WithRequest ¶
func (l *AccessLogger) WithRequest(with bool)
WithRequest 访问日志是否包含请求正文
func (*AccessLogger) WithResponse ¶
func (l *AccessLogger) WithResponse(with bool)
WithResponse 访问日志是否包含应答正文
type Response ¶
type Response struct { Status int `json:"status"` Message string `json:"message"` Data interface{} `json:"data"` }
Response 接口的应答消息基础格式
type SignatureHandler ¶
type SignatureHandler struct {
// contains filtered or unexported fields
}
SignatureHandler ...
func NewSignaturehandler ¶
func NewSignaturehandler(key string) *SignatureHandler
NewSignaturehandler ...
func (*SignatureHandler) ServeHTTP ¶
func (h *SignatureHandler) ServeHTTP(ctx iris.Context)
Click to show internal directories.
Click to hide internal directories.