Browse Source

Fix pointer references

master
parent
commit
db932be0d3
Signed by: chris GPG Key ID: 3025DCBD46F81C0F
  1. 2
      cmd/gateway/main.go
  2. 4
      gateway/gateway.go

2
cmd/gateway/main.go

@ -55,7 +55,7 @@ func main() {
// Setup HTTP endpoints. // Setup HTTP endpoints.
http.HandleFunc("/register", gateway.Register(client)) http.HandleFunc("/register", gateway.Register(client))
http.HandleFunc("/login", gateway.Login(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("/reset_password", gateway.ResetPassword(client, fmt.Sprintf("%s, %d", config.Domain, config.Port)))
http.HandleFunc("/change_password", gateway.ChangePassword(client)) http.HandleFunc("/change_password", gateway.ChangePassword(client))

4
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) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var req proto.AuthorizeRequest var req proto.AuthorizeRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil { 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{ res, err := client.Authorize(r.Context(), &proto.AuthorizeRequest{
Secret: *serverSecret,
Secret: secret,
Token: req.Token, Token: req.Token,
}) })

Loading…
Cancel
Save