mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-03-23 21:50:48 +02:00
Remove unused fields from OAuthProxy
This commit is contained in:
parent
8c25f5be0b
commit
c0654e3d9f
@ -9,6 +9,7 @@
|
|||||||
## Changes since v7.1.1
|
## Changes since v7.1.1
|
||||||
|
|
||||||
- [#1129](https://github.com/oauth2-proxy/oauth2-proxy/pull/1129) Rewrite OpenRedirect tests in ginkgo (@JoelSpeed)
|
- [#1129](https://github.com/oauth2-proxy/oauth2-proxy/pull/1129) Rewrite OpenRedirect tests in ginkgo (@JoelSpeed)
|
||||||
|
- [#1127](https://github.com/oauth2-proxy/oauth2-proxy/pull/1127) Remove unused fields from OAuthProxy (@JoelSpeed)
|
||||||
|
|
||||||
# V7.1.1
|
# V7.1.1
|
||||||
|
|
||||||
|
@ -60,15 +60,12 @@ type allowedRoute struct {
|
|||||||
|
|
||||||
// OAuthProxy is the main authentication proxy
|
// OAuthProxy is the main authentication proxy
|
||||||
type OAuthProxy struct {
|
type OAuthProxy struct {
|
||||||
CookieSeed string
|
|
||||||
CookieName string
|
|
||||||
CSRFCookieName string
|
CSRFCookieName string
|
||||||
CookieDomains []string
|
CookieDomains []string
|
||||||
CookiePath string
|
CookiePath string
|
||||||
CookieSecure bool
|
CookieSecure bool
|
||||||
CookieHTTPOnly bool
|
CookieHTTPOnly bool
|
||||||
CookieExpire time.Duration
|
CookieExpire time.Duration
|
||||||
CookieRefresh time.Duration
|
|
||||||
CookieSameSite string
|
CookieSameSite string
|
||||||
Validator func(string) bool
|
Validator func(string) bool
|
||||||
|
|
||||||
@ -88,16 +85,7 @@ type OAuthProxy struct {
|
|||||||
ProxyPrefix string
|
ProxyPrefix string
|
||||||
basicAuthValidator basic.Validator
|
basicAuthValidator basic.Validator
|
||||||
serveMux http.Handler
|
serveMux http.Handler
|
||||||
SetXAuthRequest bool
|
|
||||||
PassBasicAuth bool
|
|
||||||
SetBasicAuth bool
|
|
||||||
SkipProviderButton bool
|
SkipProviderButton bool
|
||||||
PassUserHeaders bool
|
|
||||||
BasicAuthPassword string
|
|
||||||
PassAccessToken bool
|
|
||||||
SetAuthorization bool
|
|
||||||
PassAuthorization bool
|
|
||||||
PreferEmailToUser bool
|
|
||||||
skipAuthPreflight bool
|
skipAuthPreflight bool
|
||||||
skipJwtBearerTokens bool
|
skipJwtBearerTokens bool
|
||||||
realClientIPParser ipapi.RealClientIPParser
|
realClientIPParser ipapi.RealClientIPParser
|
||||||
@ -191,15 +179,12 @@ func NewOAuthProxy(opts *options.Options, validator func(string) bool) (*OAuthPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
p := &OAuthProxy{
|
p := &OAuthProxy{
|
||||||
CookieName: opts.Cookie.Name,
|
|
||||||
CSRFCookieName: fmt.Sprintf("%v_%v", opts.Cookie.Name, "csrf"),
|
CSRFCookieName: fmt.Sprintf("%v_%v", opts.Cookie.Name, "csrf"),
|
||||||
CookieSeed: opts.Cookie.Secret,
|
|
||||||
CookieDomains: opts.Cookie.Domains,
|
CookieDomains: opts.Cookie.Domains,
|
||||||
CookiePath: opts.Cookie.Path,
|
CookiePath: opts.Cookie.Path,
|
||||||
CookieSecure: opts.Cookie.Secure,
|
CookieSecure: opts.Cookie.Secure,
|
||||||
CookieHTTPOnly: opts.Cookie.HTTPOnly,
|
CookieHTTPOnly: opts.Cookie.HTTPOnly,
|
||||||
CookieExpire: opts.Cookie.Expire,
|
CookieExpire: opts.Cookie.Expire,
|
||||||
CookieRefresh: opts.Cookie.Refresh,
|
|
||||||
CookieSameSite: opts.Cookie.SameSite,
|
CookieSameSite: opts.Cookie.SameSite,
|
||||||
Validator: validator,
|
Validator: validator,
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ func (patTest *PassAccessTokenTest) getCallbackEndpoint() (httpCode int,
|
|||||||
// getEndpointWithCookie makes a requests againt the oauthproxy with passed requestPath
|
// getEndpointWithCookie makes a requests againt the oauthproxy with passed requestPath
|
||||||
// and cookie and returns body and status code.
|
// and cookie and returns body and status code.
|
||||||
func (patTest *PassAccessTokenTest) getEndpointWithCookie(cookie string, endpoint string) (httpCode int, accessToken string) {
|
func (patTest *PassAccessTokenTest) getEndpointWithCookie(cookie string, endpoint string) (httpCode int, accessToken string) {
|
||||||
cookieName := patTest.proxy.CookieName
|
cookieName := patTest.opts.Cookie.Name
|
||||||
var value string
|
var value string
|
||||||
keyPrefix := cookieName + "="
|
keyPrefix := cookieName + "="
|
||||||
|
|
||||||
@ -983,9 +983,6 @@ func NewProcessCookieTest(opts ProcessCookieTestOpts, modifiers ...OptionsModifi
|
|||||||
}
|
}
|
||||||
pcTest.proxy.provider.(*TestProvider).SetAllowedGroups(pcTest.opts.AllowedGroups)
|
pcTest.proxy.provider.(*TestProvider).SetAllowedGroups(pcTest.opts.AllowedGroups)
|
||||||
|
|
||||||
// Now, zero-out proxy.CookieRefresh for the cases that don't involve
|
|
||||||
// access_token validation.
|
|
||||||
pcTest.proxy.CookieRefresh = time.Duration(0)
|
|
||||||
pcTest.rw = httptest.NewRecorder()
|
pcTest.rw = httptest.NewRecorder()
|
||||||
pcTest.req, _ = http.NewRequest("GET", "/", strings.NewReader(""))
|
pcTest.req, _ = http.NewRequest("GET", "/", strings.NewReader(""))
|
||||||
pcTest.validateUser = true
|
pcTest.validateUser = true
|
||||||
@ -1107,7 +1104,6 @@ func TestProcessCookieFailIfRefreshSetAndCookieExpired(t *testing.T) {
|
|||||||
err = pcTest.SaveSession(startSession)
|
err = pcTest.SaveSession(startSession)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
pcTest.proxy.CookieRefresh = time.Hour
|
|
||||||
session, err := pcTest.LoadCookiedSession()
|
session, err := pcTest.LoadCookiedSession()
|
||||||
assert.NotEqual(t, nil, err)
|
assert.NotEqual(t, nil, err)
|
||||||
if session != nil {
|
if session != nil {
|
||||||
@ -2003,7 +1999,7 @@ func TestClearSplitCookie(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
p := OAuthProxy{CookieName: opts.Cookie.Name, CookieDomains: opts.Cookie.Domains, sessionStore: store}
|
p := OAuthProxy{sessionStore: store}
|
||||||
var rw = httptest.NewRecorder()
|
var rw = httptest.NewRecorder()
|
||||||
req := httptest.NewRequest("get", "/", nil)
|
req := httptest.NewRequest("get", "/", nil)
|
||||||
|
|
||||||
@ -2036,7 +2032,7 @@ func TestClearSingleCookie(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
p := OAuthProxy{CookieName: opts.Cookie.Name, CookieDomains: opts.Cookie.Domains, sessionStore: store}
|
p := OAuthProxy{sessionStore: store}
|
||||||
var rw = httptest.NewRecorder()
|
var rw = httptest.NewRecorder()
|
||||||
req := httptest.NewRequest("get", "/", nil)
|
req := httptest.NewRequest("get", "/", nil)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user