refactor(http,rules): move SharedData and ResponseModifier to httputils

- implemented dependency injection for rule auth handler
This commit is contained in:
yusing
2025-12-05 16:06:36 +08:00
parent 8687a57b6c
commit 25ee8041da
19 changed files with 106 additions and 452 deletions

View File

@@ -1,16 +1,15 @@
package rules
import "golang.org/x/crypto/bcrypt"
import (
httputils "github.com/yusing/goutils/http"
"golang.org/x/crypto/bcrypt"
)
type (
HashedCrendentials struct {
Username string
CheckMatch func(inputPwd []byte) bool
}
Credentials struct {
Username string
Password []byte
}
)
func BCryptCrendentials(username string, hashedPassword []byte) *HashedCrendentials {
@@ -19,7 +18,7 @@ func BCryptCrendentials(username string, hashedPassword []byte) *HashedCrendenti
}}
}
func (hc *HashedCrendentials) Match(cred *Credentials) bool {
func (hc *HashedCrendentials) Match(cred *httputils.Credentials) bool {
if cred == nil {
return false
}