providers: update gitlab api endpoint to use latest version, v4

This commit is contained in:
Tanvir Alam 2017-11-06 12:01:48 -05:00
parent bfda078caa
commit f2a995b8d9
3 changed files with 6 additions and 6 deletions

View File

@ -114,7 +114,7 @@ If you are using self-hosted GitLab, make sure you set the following to the appr
-login-url="<your gitlab url>/oauth/authorize" -login-url="<your gitlab url>/oauth/authorize"
-redeem-url="<your gitlab url>/oauth/token" -redeem-url="<your gitlab url>/oauth/token"
-validate-url="<your gitlab url>/api/v3/user" -validate-url="<your gitlab url>/api/v4/user"
### LinkedIn Auth Provider ### LinkedIn Auth Provider

View File

@ -32,7 +32,7 @@ func NewGitLabProvider(p *ProviderData) *GitLabProvider {
p.ValidateURL = &url.URL{ p.ValidateURL = &url.URL{
Scheme: "https", Scheme: "https",
Host: "gitlab.com", Host: "gitlab.com",
Path: "/api/v3/user", Path: "/api/v4/user",
} }
} }
if p.Scope == "" { if p.Scope == "" {

View File

@ -28,7 +28,7 @@ func testGitLabProvider(hostname string) *GitLabProvider {
} }
func testGitLabBackend(payload string) *httptest.Server { func testGitLabBackend(payload string) *httptest.Server {
path := "/api/v3/user" path := "/api/v4/user"
query := "access_token=imaginary_access_token" query := "access_token=imaginary_access_token"
return httptest.NewServer(http.HandlerFunc( return httptest.NewServer(http.HandlerFunc(
@ -51,7 +51,7 @@ func TestGitLabProviderDefaults(t *testing.T) {
p.Data().LoginURL.String()) p.Data().LoginURL.String())
assert.Equal(t, "https://gitlab.com/oauth/token", assert.Equal(t, "https://gitlab.com/oauth/token",
p.Data().RedeemURL.String()) 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()) p.Data().ValidateURL.String())
assert.Equal(t, "read_user", p.Data().Scope) assert.Equal(t, "read_user", p.Data().Scope)
} }
@ -70,7 +70,7 @@ func TestGitLabProviderOverrides(t *testing.T) {
ValidateURL: &url.URL{ ValidateURL: &url.URL{
Scheme: "https", Scheme: "https",
Host: "example.com", Host: "example.com",
Path: "/api/v3/user"}, Path: "/api/v4/user"},
Scope: "profile"}) Scope: "profile"})
assert.NotEqual(t, nil, p) assert.NotEqual(t, nil, p)
assert.Equal(t, "GitLab", p.Data().ProviderName) assert.Equal(t, "GitLab", p.Data().ProviderName)
@ -78,7 +78,7 @@ func TestGitLabProviderOverrides(t *testing.T) {
p.Data().LoginURL.String()) p.Data().LoginURL.String())
assert.Equal(t, "https://example.com/oauth/token", assert.Equal(t, "https://example.com/oauth/token",
p.Data().RedeemURL.String()) 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()) p.Data().ValidateURL.String())
assert.Equal(t, "profile", p.Data().Scope) assert.Equal(t, "profile", p.Data().Scope)
} }