Skip to content

Commit

Permalink
bitbucket provider: remove debug prints and fixup imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ploxiln committed Feb 2, 2020
1 parent aeada85 commit 6b54a43
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
16 changes: 1 addition & 15 deletions providers/bitbucket.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package providers

import (
"fmt"
"log"
"net/http"
"net/http/httputil"
"net/url"

"github.com/bitly/oauth2_proxy/api"
"github.com/ploxiln/oauth2_proxy/api"
)

type BitbucketProvider struct {
Expand Down Expand Up @@ -48,14 +46,6 @@ func (p *BitbucketProvider) SetTeam(team string) {
p.Team = team
}

func debug(data []byte, err error) {
if err == nil {
fmt.Printf("%s\n\n", data)
} else {
log.Fatalf("%s\n\n", err)
}
}

func (p *BitbucketProvider) GetEmailAddress(s *SessionState) (string, error) {

var emails struct {
Expand All @@ -78,12 +68,10 @@ func (p *BitbucketProvider) GetEmailAddress(s *SessionState) (string, error) {
err = api.RequestJson(req, &emails)
if err != nil {
log.Printf("failed making request %s", err)
debug(httputil.DumpRequestOut(req, true))
return "", err
}

if p.Team != "" {
log.Printf("Filtering against membership in team %s\n", p.Team)
teamURL := &url.URL{}
*teamURL = *p.ValidateURL
teamURL.Path = "/2.0/teams"
Expand All @@ -96,11 +84,9 @@ func (p *BitbucketProvider) GetEmailAddress(s *SessionState) (string, error) {
err = api.RequestJson(req, &teams)
if err != nil {
log.Printf("failed requesting teams membership %s", err)
debug(httputil.DumpRequestOut(req, true))
return "", err
}
var found = false
log.Printf("%+v\n", teams)
for _, team := range teams.Values {
if p.Team == team.Name {
found = true
Expand Down
2 changes: 1 addition & 1 deletion providers/bitbucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/url"
"testing"

"github.com/bmizerany/assert"
"github.com/stretchr/testify/assert"
)

func testBitbucketProvider(hostname, team string) *BitbucketProvider {
Expand Down

0 comments on commit 6b54a43

Please sign in to comment.