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, })