From a35871889c70fc3d40e2b78dd1c38d48c46ae873 Mon Sep 17 00:00:00 2001 From: Kevin Lyda Date: Mon, 23 Jan 2017 23:13:43 +0000 Subject: Remove newClient function (and calls). --- server/auth/gitlab/gitlab.go | 10 ++-------- 1 file 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 { -- cgit v1.2.3