From f2a995b8d98054e9ee57a3da359783cf090c2f71 Mon Sep 17 00:00:00 2001 From: Tanvir Alam Date: Mon, 6 Nov 2017 12:01:48 -0500 Subject: [PATCH] providers: update gitlab api endpoint to use latest version, v4 --- README.md | 2 +- providers/gitlab.go | 2 +- providers/gitlab_test.go | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bc6d3ae..0e79061 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ If you are using self-hosted GitLab, make sure you set the following to the appr -login-url="/oauth/authorize" -redeem-url="/oauth/token" - -validate-url="/api/v3/user" + -validate-url="/api/v4/user" ### LinkedIn Auth Provider diff --git a/providers/gitlab.go b/providers/gitlab.go index d036ac7..124d719 100644 --- a/providers/gitlab.go +++ b/providers/gitlab.go @@ -32,7 +32,7 @@ func NewGitLabProvider(p *ProviderData) *GitLabProvider { p.ValidateURL = &url.URL{ Scheme: "https", Host: "gitlab.com", - Path: "/api/v3/user", + Path: "/api/v4/user", } } if p.Scope == "" { diff --git a/providers/gitlab_test.go b/providers/gitlab_test.go index 050b5c4..0eec5aa 100644 --- a/providers/gitlab_test.go +++ b/providers/gitlab_test.go @@ -28,7 +28,7 @@ func testGitLabProvider(hostname string) *GitLabProvider { } func testGitLabBackend(payload string) *httptest.Server { - path := "/api/v3/user" + path := "/api/v4/user" query := "access_token=imaginary_access_token" return httptest.NewServer(http.HandlerFunc( @@ -51,7 +51,7 @@ func TestGitLabProviderDefaults(t *testing.T) { p.Data().LoginURL.String()) assert.Equal(t, "https://gitlab.com/oauth/token", p.Data().RedeemURL.String()) - assert.Equal(t, "https://gitlab.com/api/v3/user", + assert.Equal(t, "https://gitlab.com/api/v4/user", p.Data().ValidateURL.String()) assert.Equal(t, "read_user", p.Data().Scope) } @@ -70,7 +70,7 @@ func TestGitLabProviderOverrides(t *testing.T) { ValidateURL: &url.URL{ Scheme: "https", Host: "example.com", - Path: "/api/v3/user"}, + Path: "/api/v4/user"}, Scope: "profile"}) assert.NotEqual(t, nil, p) assert.Equal(t, "GitLab", p.Data().ProviderName) @@ -78,7 +78,7 @@ func TestGitLabProviderOverrides(t *testing.T) { p.Data().LoginURL.String()) assert.Equal(t, "https://example.com/oauth/token", p.Data().RedeemURL.String()) - assert.Equal(t, "https://example.com/api/v3/user", + assert.Equal(t, "https://example.com/api/v4/user", p.Data().ValidateURL.String()) assert.Equal(t, "profile", p.Data().Scope) }