mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-17 15:40:25 +08:00
访问控制支持基本认证和子请求认证
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/base64"
|
||||
"github.com/iwind/TeaGo/assert"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
stringutil "github.com/iwind/TeaGo/utils/string"
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
@@ -35,30 +34,6 @@ func TestHTTPAuthBasicMethodUser_Validate(t *testing.T) {
|
||||
}
|
||||
a.IsFalse(b)
|
||||
}
|
||||
|
||||
{
|
||||
user := &HTTPAuthBasicMethodUser{
|
||||
Password: stringutil.Md5("123456"),
|
||||
Encoder: "md5",
|
||||
}
|
||||
b, err := user.Validate("123456")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
a.IsTrue(b)
|
||||
}
|
||||
|
||||
{
|
||||
user := &HTTPAuthBasicMethodUser{
|
||||
Password: base64.StdEncoding.EncodeToString([]byte("123456")),
|
||||
Encoder: "base64",
|
||||
}
|
||||
b, err := user.Validate("123456")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
a.IsTrue(b)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHTTPAuthBasicMethod_Filter(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user