Merge pull request #496 from talam/update_gitlab_api_endpoint

providers: update gitlab api endpoint to use latest version, v4
This commit is contained in:
Jehiah Czebotar 2017-11-06 13:15:45 -05:00 committed by GitHub
commit 28e217dc8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"
-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

View File

@ -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 == "" {

View File

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