Docker test
This commit is contained in:
@ -7,7 +7,7 @@ import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
// "os"
|
||||
|
||||
"github.com/HelloWorld/goProductAPI/entity"
|
||||
"github.com/gorilla/mux"
|
||||
@ -150,8 +150,10 @@ func AuthHandler(h http.Handler) http.HandlerFunc {
|
||||
return func(rw http.ResponseWriter, r *http.Request) {
|
||||
user, pass, ok := r.BasicAuth()
|
||||
if ok {
|
||||
username := sha256.Sum256([]byte(os.Getenv("USER_NAME")))
|
||||
password := sha256.Sum256([]byte(os.Getenv("USER_PASS")))
|
||||
// username := sha256.Sum256([]byte(os.Getenv("USER_NAME")))
|
||||
// password := sha256.Sum256([]byte(os.Getenv("USER_PASS")))
|
||||
username := sha256.Sum256([]byte("1234"))
|
||||
password := sha256.Sum256([]byte("1234"))
|
||||
userHash := sha256.Sum256([]byte(user))
|
||||
passHash := sha256.Sum256([]byte(pass))
|
||||
validUser := subtle.ConstantTimeCompare(userHash[:],username[:]) == 1
|
||||
|
Reference in New Issue
Block a user