mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 09:48:32 +02:00
refactor(http,rules): move SharedData and ResponseModifier to httputils
- implemented dependency injection for rule auth handler
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user