mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 05:00:24 +08:00 
			
		
		
		
	访问控制支持基本认证和子请求认证
This commit is contained in:
		@@ -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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user