From db932be0d31462e9074ba64b338540d5c7198047 Mon Sep 17 00:00:00 2001 From: Christopher James Hayward Date: Mon, 17 Jul 2023 10:08:43 -0400 Subject: [PATCH] Fix pointer references --- cmd/gateway/main.go | 2 +- gateway/gateway.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/gateway/main.go b/cmd/gateway/main.go index bb22a2a..7f9a448 100644 --- a/cmd/gateway/main.go +++ b/cmd/gateway/main.go @@ -55,7 +55,7 @@ func main() { // Setup HTTP endpoints. http.HandleFunc("/register", gateway.Register(client)) http.HandleFunc("/login", gateway.Login(client)) - http.HandleFunc("/logout", gateway.Authorize(client, &config.Server.Secret, gateway.Logout(client))) + http.HandleFunc("/logout", gateway.Authorize(client, config.Server.Secret, gateway.Logout(client))) http.HandleFunc("/reset_password", gateway.ResetPassword(client, fmt.Sprintf("%s, %d", config.Domain, config.Port))) http.HandleFunc("/change_password", gateway.ChangePassword(client)) diff --git a/gateway/gateway.go b/gateway/gateway.go index 73d558c..3366d66 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -63,7 +63,7 @@ func Logout(client proto.UsersClient) http.HandlerFunc { }) } -func Authorize(client proto.UsersClient, serverSecret *string, next http.HandlerFunc) http.HandlerFunc { +func Authorize(client proto.UsersClient, secret string, next http.HandlerFunc) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var req proto.AuthorizeRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { @@ -73,7 +73,7 @@ func Authorize(client proto.UsersClient, serverSecret *string, next http.Handler } res, err := client.Authorize(r.Context(), &proto.AuthorizeRequest{ - Secret: *serverSecret, + Secret: secret, Token: req.Token, })