Skip to content

Commit a1c993f

Browse files
committed
hmac auth: get rid of unnecessary method
1 parent 5c33b3e commit a1c993f

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

auth/hmac.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ func VerifyHMACLoginAndPassword(secret []byte, login, password string) bool {
8383
return hmac.Equal(token.Signature[:], expectedMAC)
8484
}
8585

86-
func (auth *HMACAuth) validateToken(login, password string) bool {
87-
return VerifyHMACLoginAndPassword(auth.secret, login, password)
88-
}
89-
9086
func (auth *HMACAuth) Validate(wr http.ResponseWriter, req *http.Request) (string, bool) {
9187
hdr := req.Header.Get("Proxy-Authorization")
9288
if hdr == "" {
@@ -115,7 +111,7 @@ func (auth *HMACAuth) Validate(wr http.ResponseWriter, req *http.Request) (strin
115111
login := pair[0]
116112
password := pair[1]
117113

118-
if auth.validateToken(login, password) {
114+
if VerifyHMACLoginAndPassword(auth.secret, login, password) {
119115
if auth.hiddenDomain != "" &&
120116
(req.Host == auth.hiddenDomain || req.URL.Host == auth.hiddenDomain) {
121117
wr.Header().Set("Content-Length", strconv.Itoa(len([]byte(AUTH_TRIGGERED_MSG))))

0 commit comments

Comments
 (0)