Documentation
¶
Index ¶
- Variables
- func CheckRequest(instance Auth, r *http.Request) error
- func CheckURI(instance Auth, url *url.URL) error
- func Init()
- func SignRequest(instance Auth, r *http.Request, expires int64) *http.Request
- func SignURI(instance Auth, uri string, expires int64) (*url.URL, error)
- type Auth
- type HMACAuth
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAuthFailed = serializer.NewError(serializer.CodeNoPermissionErr, "鉴权失败", nil) ErrExpired = serializer.NewError(serializer.CodeSignExpired, "签名已过期", nil) )
Functions ¶
func CheckRequest ¶
CheckRequest 对复杂请求进行签名验证
func SignRequest ¶
SignRequest 对PUT\POST等复杂HTTP请求签名,如果请求Header中 包含 X-Policy, 则此请求会被认定为上传请求,只会对URI部分和 Policy部分进行签名。其他请求则会对URI和Body部分进行签名。
Types ¶
type Auth ¶
type Auth interface { // 对给定Body进行签名,expires为0表示永不过期 Sign(body string, expires int64) string // 对给定Body和Sign进行检查 Check(body string, sign string) error }
Auth 鉴权认证
var General Auth
General 通用的认证接口
Click to show internal directories.
Click to hide internal directories.