访问控制支持基本认证和子请求认证

This commit is contained in:
刘祥超
2021-06-19 21:36:13 +08:00
parent dcdb6a923a
commit ddacb945e1
5 changed files with 53 additions and 46 deletions

View File

@@ -7,13 +7,6 @@ import (
"net/http"
)
type HTTPAuthType = string
const (
HTTPAuthTypeBasicAuth HTTPAuthType = "basicAuth" // BasicAuth
HTTPAuthTypeSubRequest HTTPAuthType = "subRequest" // 子请求
)
// HTTPAuthPolicy HTTP认证策略
type HTTPAuthPolicy struct {
Id int64 `json:"id"`
@@ -53,3 +46,8 @@ func (this *HTTPAuthPolicy) Filter(req *http.Request, subReqFunc func(subReq *ht
}
return this.method.Filter(req, subReqFunc, formatter)
}
// Method 获取认证实例
func (this *HTTPAuthPolicy) Method() HTTPAuthMethodInterface {
return this.method
}