diff options
Diffstat (limited to 'go/internal/gitlabnet/accessverifier')
-rw-r--r-- | go/internal/gitlabnet/accessverifier/client.go | 6 | ||||
-rw-r--r-- | go/internal/gitlabnet/accessverifier/client_test.go | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/go/internal/gitlabnet/accessverifier/client.go b/go/internal/gitlabnet/accessverifier/client.go index f0dea7d..880fff5 100644 --- a/go/internal/gitlabnet/accessverifier/client.go +++ b/go/internal/gitlabnet/accessverifier/client.go @@ -8,6 +8,7 @@ import ( "gitlab.com/gitlab-org/gitlab-shell/go/internal/command/commandargs" "gitlab.com/gitlab-org/gitlab-shell/go/internal/config" "gitlab.com/gitlab-org/gitlab-shell/go/internal/gitlabnet" + "gitlab.com/gitlab-org/gitlab-shell/go/internal/sshenv" ) const ( @@ -26,6 +27,7 @@ type Request struct { Protocol string `json:"protocol"` KeyId string `json:"key_id,omitempty"` Username string `json:"username,omitempty"` + CheckIp string `json:"check_ip,omitempty"` } type Gitaly struct { @@ -80,7 +82,9 @@ func (c *Client) Verify(args *commandargs.Shell, action commandargs.CommandType, request.KeyId = args.GitlabKeyId } - response, err := c.client.Post("/allowed/secure", request) + request.CheckIp = sshenv.LocalAddr() + + response, err := c.client.Post("/allowed", request) if err != nil { return nil, err } diff --git a/go/internal/gitlabnet/accessverifier/client_test.go b/go/internal/gitlabnet/accessverifier/client_test.go index 0f08c0b..f534185 100644 --- a/go/internal/gitlabnet/accessverifier/client_test.go +++ b/go/internal/gitlabnet/accessverifier/client_test.go @@ -157,7 +157,7 @@ func setup(t *testing.T) (*Client, func()) { requests := []testserver.TestRequestHandler{ { - Path: "/api/v4/internal/allowed/secure", + Path: "/api/v4/internal/allowed", Handler: func(w http.ResponseWriter, r *http.Request) { b, err := ioutil.ReadAll(r.Body) require.NoError(t, err) |