config: use getters for authenticate, signout and forward auth urls (#2000)

This commit is contained in:
Caleb Doxsey 2021-03-19 14:49:25 -06:00 committed by GitHub
parent 1febaa82ff
commit 3690a32855
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 152 additions and 136 deletions

View file

@ -37,10 +37,9 @@ func TestOptions_Validate(t *testing.T) {
good := testOptions(t)
badAuthURL := testOptions(t)
badAuthURL.AuthenticateURL = nil
authurl, _ := url.Parse("authenticate.corp.beyondperimeter.com")
badAuthURL.AuthenticateURLString = "BAD_URL"
authenticateBadScheme := testOptions(t)
authenticateBadScheme.AuthenticateURL = authurl
authenticateBadScheme.AuthenticateURLString = "authenticate.corp.beyondperimeter.com"
emptyCookieSecret := testOptions(t)
emptyCookieSecret.CookieSecret = ""
invalidCookieSecret := testOptions(t)
@ -161,7 +160,7 @@ func Test_UpdateOptions(t *testing.T) {
disableAuth := testOptions(t)
disableAuth.Policies = []config.Policy{{To: toFoo, From: "http://bar.example", AllowPublicUnauthenticatedAccess: true}}
fwdAuth := testOptions(t)
fwdAuth.ForwardAuthURL = &url.URL{Scheme: "https", Host: "corp.example.example"}
fwdAuth.ForwardAuthURLString = "https://corp.example.example"
reqHeaders := testOptions(t)
reqHeaders.Policies = []config.Policy{{To: toFoo, From: "http://bar.example", SetRequestHeaders: map[string]string{"x": "y"}}}
preserveHostHeader := testOptions(t)