git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #197 from ruta-goomba/enterprise-github
36128e9Jehiah Czebotar
README.md+6
@@ -97,6 +97,12 @@ The GitHub auth provider supports two additional parameters to restrict authenti
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 this team
99
99
100+If you are using github enterprise, make sure you set the following to the appropriate url:
101+
102+ -login-url="<enterprise github url>/login/oauth/authorize"
103+ -redeem-url="<enterprise github url>/login/oauth/access_token"
104+ -validate-url="<enterprise github api url>/user/emails"
105+
100
106
101### LinkedIn Auth Provider
107### LinkedIn Auth Provider
102
108
providers/github.go+3−3
@@ -63,7 +63,7 @@ func (p *GitHubProvider) hasOrg(accessToken string) (bool, error) {
63 "limit": {"100"},
63 "limit": {"100"},
64 }
64 }
65
65
66− endpoint := "https://api.github.com/user/orgs?" + params.Encode()
66+ endpoint := p.ValidateURL.Scheme + "://" + p.ValidateURL.Host + "/user/orgs?" + params.Encode()
67 req, _ := http.NewRequest("GET", endpoint, nil)
67 req, _ := http.NewRequest("GET", endpoint, nil)
68 req.Header.Set("Accept", "application/vnd.github.v3+json")
68 req.Header.Set("Accept", "application/vnd.github.v3+json")
69 resp, err := http.DefaultClient.Do(req)
69 resp, err := http.DefaultClient.Do(req)
@@ -113,7 +113,7 @@ func (p *GitHubProvider) hasOrgAndTeam(accessToken string) (bool, error) {
113 "limit": {"100"},
113 "limit": {"100"},
114 }
114 }
115
115
116− endpoint := "https://api.github.com/user/teams?" + params.Encode()
116+ endpoint := p.ValidateURL.Scheme + "://" + p.ValidateURL.Host + "/user/teams?" + params.Encode()
117 req, _ := http.NewRequest("GET", endpoint, nil)
117 req, _ := http.NewRequest("GET", endpoint, nil)
118 req.Header.Set("Accept", "application/vnd.github.v3+json")
118 req.Header.Set("Accept", "application/vnd.github.v3+json")
119 resp, err := http.DefaultClient.Do(req)
119 resp, err := http.DefaultClient.Do(req)
@@ -183,7 +183,7 @@ func (p *GitHubProvider) GetEmailAddress(s *SessionState) (string, error) {
183 params := url.Values{
183 params := url.Values{
184 "access_token": {s.AccessToken},
184 "access_token": {s.AccessToken},
185 }
185 }
186− endpoint := "https://api.github.com/user/emails?" + params.Encode()
186+ endpoint := p.ValidateURL.Scheme + "://" + p.ValidateURL.Host + p.ValidateURL.Path + "?" + params.Encode()
187 resp, err := http.DefaultClient.Get(endpoint)
187 resp, err := http.DefaultClient.Get(endpoint)
188 if err != nil {
188 if err != nil {
189 return "", err
189 return "", err