You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-12-01 22:51:45 +02:00
Feature: Add GitHub groups (orgs/teams) support (#2196)
* Add GitHub groups (orgs/teams) support * align code of getTeams with getOrgs to support Github Enterprise Server instances with different domain * add documentation * add missing import after rebase * add nightly build and push (#2297) * add nightly build and push * add date based nightly build tags * only keep single multiarch image build and push * add changelog * add images to internal docs static files * add docu for nightly builds * remove unnecessary spaces * update nightly repository * Issue 978: Fix Custom cookie name breaks redis for session (#1949) * Issue 978: Fix Custom cookie name breaks redis for session (see https://github.com/oauth2-proxy/oauth2-proxy/issues/978) * Issue 978: Fix Custom cookie name breaks redis for session (see https://github.com/oauth2-proxy/oauth2-proxy/issues/978) * Update CHANGELOG.md * Issue 978: Fix Custom cookie name breaks redis for session * Issue 978: Fix Custom cookie name breaks redis for session * Issue 978: Fix Custom cookie name breaks redis for session * Issue 978: Fix Custom cookie name breaks redis for session * Issue 978: Fix Custom cookie name breaks redis for session * Issue 978: Fix Custom cookie name breaks redis for session * Update CHANGELOG.md --------- Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com> Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk> * Support http.AllowQuerySemicolons (#2248) * Support http.AllowQuerySemicolons * Docs * Make it clear we are overriding the handler * Update documentation for allow-query-semicolons * Fix changelog format * Fix formatting --------- Co-authored-by: MickMake <github@mickmake.com> * Add GitHub groups (orgs/teams) support * align code of getTeams with getOrgs to support Github Enterprise Server instances with different domain * add documentation * fix changelog & documentation * fix missing import --------- Co-authored-by: Tobias Mayer <github@tobiasm.de> Co-authored-by: Nuno Miguel Micaelo Borges <miguelborges99@gmail.com> Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com> Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk> Co-authored-by: Tim White <tim.white@su.org.au> Co-authored-by: MickMake <github@mickmake.com>
This commit is contained in:
@@ -82,8 +82,8 @@ func TestNewGitHubProvider(t *testing.T) {
|
||||
g.Expect(providerData.LoginURL.String()).To(Equal(githubDefaultLoginURL.String()))
|
||||
g.Expect(providerData.RedeemURL.String()).To(Equal(githubDefaultRedeemURL.String()))
|
||||
g.Expect(providerData.ProfileURL.String()).To(Equal(""))
|
||||
g.Expect(providerData.ValidateURL.String()).To(Equal(githubDefaultValidateURL.String()))
|
||||
g.Expect(providerData.Scope).To(Equal("user:email"))
|
||||
g.Expect(providerData.ValidateURL.String()).To(Equal("https://api.github.com/"))
|
||||
g.Expect(providerData.Scope).To(Equal("user:email read:org"))
|
||||
}
|
||||
|
||||
func TestGitHubProviderOverrides(t *testing.T) {
|
||||
@@ -231,7 +231,7 @@ func TestGitHubProvider_getEmailWithWriteAccessToPrivateRepo(t *testing.T) {
|
||||
assert.Equal(t, "michael.bland@gsa.gov", session.Email)
|
||||
}
|
||||
|
||||
func TestGitHubProvider_getEmailWithNoAccessToPrivateRepo(t *testing.T) {
|
||||
func TestGitHubProvider_checkRestrictionsWithNoAccessToPrivateRepo(t *testing.T) {
|
||||
b := testGitHubBackend(map[string][]string{
|
||||
"/repos/oauth2-proxy/oauth2-proxy": {`{}`},
|
||||
})
|
||||
@@ -245,8 +245,8 @@ func TestGitHubProvider_getEmailWithNoAccessToPrivateRepo(t *testing.T) {
|
||||
)
|
||||
|
||||
session := CreateAuthorizedSession()
|
||||
err := p.getEmail(context.Background(), session)
|
||||
assert.NoError(t, err)
|
||||
err := p.checkRestrictions(context.Background(), session)
|
||||
assert.Error(t, err)
|
||||
assert.Empty(t, session.Email)
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ func TestGitHubProvider_getEmailWithUsername(t *testing.T) {
|
||||
assert.Equal(t, "michael.bland@gsa.gov", session.Email)
|
||||
}
|
||||
|
||||
func TestGitHubProvider_getEmailWithNotAllowedUsername(t *testing.T) {
|
||||
func TestGitHubProvider_checkRestrictionsWithNotAllowedUsername(t *testing.T) {
|
||||
b := testGitHubBackend(map[string][]string{
|
||||
"/user": {`{"email": "michael.bland@gsa.gov", "login": "mbland"}`},
|
||||
"/user/emails": {`[ {"email": "michael.bland@gsa.gov", "verified": true, "primary": true} ]`},
|
||||
@@ -392,7 +392,7 @@ func TestGitHubProvider_getEmailWithNotAllowedUsername(t *testing.T) {
|
||||
)
|
||||
|
||||
session := CreateAuthorizedSession()
|
||||
err := p.getEmail(context.Background(), session)
|
||||
err := p.checkRestrictions(context.Background(), session)
|
||||
assert.Error(t, err)
|
||||
assert.Empty(t, session.Email)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user