git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #214 from raphink/github_multiple_teams
293d674Jehiah Czebotar
README.md+1−1
@@ -95,7 +95,7 @@ The Azure AD auth provider uses `openid` as it default scope. It uses `https://g
95The GitHub auth provider supports two additional parameters to restrict authentication to Organization or Team level access. Restricting by org and team is normally accompanied with `--email-domain=*`
95The GitHub auth provider supports two additional parameters to restrict authentication to Organization or Team level access. Restricting by org and team is normally accompanied with `--email-domain=*`
96
96
97 -github-org="": restrict logins to members of this organisation
97 -github-org="": restrict logins to members of this organisation
98− -github-team="": restrict logins to members of this team
98+ -github-team="": restrict logins to members of any of these teams, separated by a comma
99
99
100If you are using github enterprise, make sure you set the following to the appropriate url:
100If you are using github enterprise, make sure you set the following to the appropriate url:
101
101
providers/github.go+7−3
@@ -3,6 +3,7 @@ package providers
3import (
3import (
4 "encoding/json"
4 "encoding/json"
5 "fmt"
5 "fmt"
6+ "strings"
6 "io/ioutil"
7 "io/ioutil"
7 "log"
8 "log"
8 "net/http"
9 "net/http"
@@ -141,9 +142,12 @@ func (p *GitHubProvider) hasOrgAndTeam(accessToken string) (bool, error) {
141 presentOrgs[team.Org.Login] = true
142 presentOrgs[team.Org.Login] = true
142 if p.Org == team.Org.Login {
143 if p.Org == team.Org.Login {
143 hasOrg = true
144 hasOrg = true
145+ ts := strings.Split(p.Team, ",")
146+ for _, t := range ts {
144− if p.Team == team.Slug {
147+ if t == team.Slug {
145− log.Printf("Found Github Organization:%q Team:%q (Name:%q)", team.Org.Login, team.Slug, team.Name)
148+ log.Printf("Found Github Organization:%q Team:%q (Name:%q)", team.Org.Login, team.Slug, team.Name)
146− return true, nil
149+ return true, nil
150+ }
147 }
151 }
148 presentTeams = append(presentTeams, team.Slug)
152 presentTeams = append(presentTeams, team.Slug)
149 }
153 }