Merge pull request #5 from outlook/pasoroki_fix

Fixing issues that caused test failures
This commit is contained in:
Pavel Sorokin 2017-06-28 11:37:09 +08:00 committed by GitHub
commit dd598b3e9b
5 changed files with 3 additions and 15 deletions

View File

@ -1,8 +1,6 @@
oauth2_proxy
=================
<small>(This project was renamed from Google Auth Proxy - May 2015)</small>
A reverse proxy and static file server that provides authentication using Providers (Google, GitHub, and others)
to validate accounts by email, domain or group.

View File

@ -78,7 +78,6 @@ func TestEncodedSlashes(t *testing.T) {
func TestRobotsTxt(t *testing.T) {
opts := NewOptions()
opts.Provider = "google"
opts.ClientID = "bazquux"
opts.ClientSecret = "foobar"
opts.CookieSecret = "xyzzyplugh"
@ -152,7 +151,6 @@ func TestBasicAuthPassword(t *testing.T) {
opts.Upstreams = append(opts.Upstreams, provider_server.URL)
// The CookieSecret must be 32 bytes in order to create the AES
// cipher.
opts.Provider = "google"
opts.CookieSecret = "xyzzyplughxyzzyplughxyzzyplughxp"
opts.ClientID = "bazquux"
opts.ClientSecret = "foobar"
@ -247,7 +245,6 @@ func NewPassAccessTokenTest(opts PassAccessTokenTestOptions) *PassAccessTokenTes
t.opts.Upstreams = append(t.opts.Upstreams, t.provider_server.URL)
// The CookieSecret must be 32 bytes in order to create the AES
// cipher.
t.opts.Provider = "google"
t.opts.CookieSecret = "xyzzyplughxyzzyplughxyzzyplughxp"
t.opts.ClientID = "bazquux"
t.opts.ClientSecret = "foobar"
@ -373,7 +370,6 @@ func NewSignInPageTest() *SignInPageTest {
var sip_test SignInPageTest
sip_test.opts = NewOptions()
sip_test.opts.Provider = "google"
sip_test.opts.CookieSecret = "foobar"
sip_test.opts.ClientID = "bazquux"
sip_test.opts.ClientSecret = "xyzzyplugh"
@ -445,7 +441,6 @@ func NewProcessCookieTest(opts ProcessCookieTestOpts) *ProcessCookieTest {
var pc_test ProcessCookieTest
pc_test.opts = NewOptions()
pc_test.opts.Provider = "google"
pc_test.opts.ClientID = "bazquux"
pc_test.opts.ClientSecret = "xyzzyplugh"
pc_test.opts.CookieSecret = "0123456789abcdefabcd"
@ -704,7 +699,6 @@ type SignatureTest struct {
func NewSignatureTest() *SignatureTest {
opts := NewOptions()
opts.Provider = "google"
opts.CookieSecret = "cookie secret"
opts.ClientID = "client ID"
opts.ClientSecret = "client secret"

View File

@ -111,6 +111,7 @@ func NewOptions() *Options {
PassHostHeader: true,
ApprovalPrompt: "",
RequestLogging: true,
Provider: "google",
}
}

View File

@ -14,7 +14,6 @@ import (
func testOptions() *Options {
o := NewOptions()
o.Upstreams = append(o.Upstreams, "http://127.0.0.1:8080/")
o.Provider = "google"
o.CookieSecret = "foobar"
o.ClientID = "bazquux"
o.ClientSecret = "xyzzyplugh"
@ -39,8 +38,7 @@ func TestNewOptions(t *testing.T) {
"missing setting: upstream",
"missing setting: cookie-secret",
"missing setting: client-id",
"missing setting: client-secret",
"missing setting: provider"})
"missing setting: client-secret"})
assert.Equal(t, expected, err.Error())
}

View File

@ -1,7 +1,6 @@
package providers
import (
"errors"
"github.com/bitly/oauth2_proxy/cookie"
)
@ -32,9 +31,7 @@ func New(provider string, p *ProviderData) (Provider, error) {
return NewAzureProvider(p), nil
case "gitlab":
return NewGitLabProvider(p), nil
case "google":
return NewGoogleProvider(p), nil
default:
return nil, errors.New("missing setting: provider")
return NewGoogleProvider(p), nil
}
}