1.5.0
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
)
|
||||
|
||||
var httpAuthTimestampRegexp = regexp.MustCompile(`^\d{10}$`)
|
||||
var httpAuthHexTimestampRegexp = regexp.MustCompile(`^[0-9a-fA-F]{1,16}$`)
|
||||
|
||||
type HTTPAuthBaseMethod struct {
|
||||
Exts []string `json:"exts"`
|
||||
|
||||
@@ -7,12 +7,12 @@ type HTTPAuthType = string
|
||||
|
||||
const (
|
||||
HTTPAuthTypeBasicAuth HTTPAuthType = "basicAuth" // BasicAuth
|
||||
HTTPAuthTypeSubRequest HTTPAuthType = "subRequest" // 子请求
|
||||
|
||||
HTTPAuthTypeTypeA HTTPAuthType = "typeA"
|
||||
HTTPAuthTypeTypeB HTTPAuthType = "typeB"
|
||||
HTTPAuthTypeTypeC HTTPAuthType = "typeC"
|
||||
HTTPAuthTypeTypeD HTTPAuthType = "typeD"
|
||||
HTTPAuthTypeSubRequest HTTPAuthType = "subRequest" // SubRequest
|
||||
HTTPAuthTypeTypeA HTTPAuthType = "typeA"
|
||||
HTTPAuthTypeTypeB HTTPAuthType = "typeB"
|
||||
HTTPAuthTypeTypeC HTTPAuthType = "typeC"
|
||||
HTTPAuthTypeTypeD HTTPAuthType = "typeD"
|
||||
HTTPAuthTypeTypeE HTTPAuthType = "typeE"
|
||||
)
|
||||
|
||||
type HTTPAuthTypeDefinition struct {
|
||||
@@ -23,10 +23,11 @@ type HTTPAuthTypeDefinition struct {
|
||||
}
|
||||
|
||||
func FindAllHTTPAuthTypes(role string) []*HTTPAuthTypeDefinition {
|
||||
var urlDocA = ""
|
||||
var urlDocB = ""
|
||||
var urlDocC = ""
|
||||
var urlDocD = ""
|
||||
urlDocA := ""
|
||||
urlDocB := ""
|
||||
urlDocC := ""
|
||||
urlDocD := ""
|
||||
urlDocE := "https://help.aliyun.com/zh/cdn/user-guide/type-c-signing"
|
||||
|
||||
switch role {
|
||||
case "admin":
|
||||
@@ -66,15 +67,21 @@ func FindAllHTTPAuthTypes(role string) []*HTTPAuthTypeDefinition {
|
||||
Description: "示例URL:https://example.com/images/test.jpg?sign=f66af42f87cf63a64f4b86ec11c7797a&t=1661753717<br/><a href=\"" + urlDocD + "\" target=\"_blank\">[算法详解]</a>",
|
||||
IsPlus: true,
|
||||
},
|
||||
{
|
||||
Name: "URL鉴权E",
|
||||
Code: HTTPAuthTypeTypeE,
|
||||
Description: "严格兼容阿里云 Type-C 路径鉴权,示例URL:https://example.com/3a2c79f2d2f0df2f8f9e05ec9f482e5d/67cfdb9e/images/test.jpg<br/><a href=\"" + urlDocE + "\" target=\"_blank\">[阿里云文档]</a>",
|
||||
IsPlus: true,
|
||||
},
|
||||
{
|
||||
Name: "基本认证",
|
||||
Code: HTTPAuthTypeBasicAuth,
|
||||
Description: "BasicAuth,最简单的HTTP请求认证方式,通过传递<span class=\"ui label tiny basic text\">Authorization: Basic xxx</span> Header认证。",
|
||||
Description: "BasicAuth,最简单的 HTTP 请求认证方式,通过传递 <span class=\"ui label tiny basic text\">Authorization: Basic xxx</span> Header 认证。",
|
||||
},
|
||||
{
|
||||
Name: "子请求",
|
||||
Code: HTTPAuthTypeSubRequest,
|
||||
Description: "通过自定义的URL子请求来认证请求。",
|
||||
Description: "通过自定义的 URL 子请求来认证请求。",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ func (this *HTTPAuthPolicy) Init() error {
|
||||
this.method = NewHTTPAuthTypeCMethod()
|
||||
case HTTPAuthTypeTypeD:
|
||||
this.method = NewHTTPAuthTypeDMethod()
|
||||
case HTTPAuthTypeTypeE:
|
||||
this.method = NewHTTPAuthTypeEMethod()
|
||||
}
|
||||
|
||||
if this.method == nil {
|
||||
|
||||
Reference in New Issue
Block a user