aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Lyda <kevin@ie.suberic.net>2017-01-23 23:13:43 +0000
committerNiall Sheridan <nsheridan@gmail.com>2017-01-25 00:52:02 +0000
commita35871889c70fc3d40e2b78dd1c38d48c46ae873 (patch)
treeeef842caccafc06b14f2643ea62b9527c446aca2
parent71b508cc61f69c5905ac02e4924cd80a04299187 (diff)
Remove newClient function (and calls).
-rw-r--r--server/auth/gitlab/gitlab.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/server/auth/gitlab/gitlab.go b/server/auth/gitlab/gitlab.go
index bd7eb8e..ec735c5 100644
--- a/server/auth/gitlab/gitlab.go
+++ b/server/auth/gitlab/gitlab.go
@@ -2,7 +2,6 @@ package gitlab
import (
"errors"
- "net/http"
"strconv"
"github.com/nsheridan/cashier/server/auth"
@@ -68,11 +67,6 @@ func New(c *config.Auth) (auth.Provider, error) {
}, nil
}
-// A new oauth2 http client.
-func (c *Config) newClient(token *oauth2.Token) *http.Client {
- return c.config.Client(oauth2.NoContext, token)
-}
-
// Name returns the name of the provider.
func (c *Config) Name() string {
return name
@@ -94,7 +88,7 @@ func (c *Config) Valid(token *oauth2.Token) bool {
// here if user whitelist is set and user is in whitelist.
return true
}
- client := gitlabapi.NewOAuthClient(c.newClient(token), token.AccessToken)
+ client := gitlabapi.NewOAuthClient(nil, token.AccessToken)
client.SetBaseURL(c.baseurl)
groups, _, err := client.Groups.SearchGroup(c.group)
if err != nil {
@@ -129,7 +123,7 @@ func (c *Config) Exchange(code string) (*oauth2.Token, error) {
// Username retrieves the username of the Gitlab user.
func (c *Config) Username(token *oauth2.Token) string {
- client := gitlabapi.NewOAuthClient(c.newClient(token), token.AccessToken)
+ client := gitlabapi.NewOAuthClient(nil, token.AccessToken)
client.SetBaseURL(c.baseurl)
u, _, err := client.Users.CurrentUser()
if err != nil {