You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-08-10 22:51:31 +02:00
Integrate klog into providers package
This commit is contained in:
@@ -12,7 +12,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/sessions"
|
||||
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/logger"
|
||||
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/requests"
|
||||
)
|
||||
|
||||
@@ -162,13 +161,13 @@ func (p *GitHubProvider) hasOrg(ctx context.Context, accessToken string) (bool,
|
||||
presentOrgs := make([]string, 0, len(orgs))
|
||||
for _, org := range orgs {
|
||||
if p.Org == org.Login {
|
||||
logger.Printf("Found Github Organization: %q", org.Login)
|
||||
debugLogger.Infof("Found Github Organization: %q", org.Login)
|
||||
return true, nil
|
||||
}
|
||||
presentOrgs = append(presentOrgs, org.Login)
|
||||
}
|
||||
|
||||
logger.Printf("Missing Organization:%q in %v", p.Org, presentOrgs)
|
||||
debugLogger.Infof("Missing Organization:%q in %v", p.Org, presentOrgs)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
@@ -270,7 +269,7 @@ func (p *GitHubProvider) hasOrgAndTeam(ctx context.Context, accessToken string)
|
||||
ts := strings.Split(p.Team, ",")
|
||||
for _, t := range ts {
|
||||
if t == team.Slug {
|
||||
logger.Printf("Found Github Organization:%q Team:%q (Name:%q)", team.Org.Login, team.Slug, team.Name)
|
||||
debugLogger.Infof("Found Github Organization:%q Team:%q (Name:%q)", team.Org.Login, team.Slug, team.Name)
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
@@ -278,13 +277,13 @@ func (p *GitHubProvider) hasOrgAndTeam(ctx context.Context, accessToken string)
|
||||
}
|
||||
}
|
||||
if hasOrg {
|
||||
logger.Printf("Missing Team:%q from Org:%q in teams: %v", p.Team, p.Org, presentTeams)
|
||||
debugLogger.Infof("Missing Team:%q from Org:%q in teams: %v", p.Team, p.Org, presentTeams)
|
||||
} else {
|
||||
var allOrgs []string
|
||||
for org := range presentOrgs {
|
||||
allOrgs = append(allOrgs, org)
|
||||
}
|
||||
logger.Printf("Missing Organization:%q in %#v", p.Org, allOrgs)
|
||||
debugLogger.Infof("Missing Organization:%q in %#v", p.Org, allOrgs)
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
@@ -373,7 +372,7 @@ func (p *GitHubProvider) isCollaborator(ctx context.Context, username, accessTok
|
||||
result.StatusCode(), endpoint.String(), result.Body())
|
||||
}
|
||||
|
||||
logger.Printf("got %d from %q %s", result.StatusCode(), endpoint.String(), result.Body())
|
||||
traceLogger.Infof("Checking collaborator status: Got %d from %q %s", result.StatusCode(), endpoint.String(), result.Body())
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user