mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-05-27 23:08:10 +02:00
Remove unneeded cookie fields from OAuth2 Proxy
This commit is contained in:
parent
812aabe5da
commit
f819200325
@ -66,8 +66,8 @@ type allowedRoute struct {
|
||||
|
||||
// OAuthProxy is the main authentication proxy
|
||||
type OAuthProxy struct {
|
||||
CookieOptions *options.Cookie
|
||||
Validator func(string) bool
|
||||
CookieSecure bool
|
||||
Validator func(string) bool
|
||||
|
||||
SignInPath string
|
||||
|
||||
@ -191,8 +191,8 @@ func NewOAuthProxy(opts *options.Options, validator func(string) bool) (*OAuthPr
|
||||
})
|
||||
|
||||
p := &OAuthProxy{
|
||||
CookieOptions: &opts.Cookie,
|
||||
Validator: validator,
|
||||
CookieSecure: opts.Cookie.Secure,
|
||||
Validator: validator,
|
||||
|
||||
SignInPath: fmt.Sprintf("%s/sign_in", opts.ProxyPrefix),
|
||||
|
||||
|
@ -434,7 +434,7 @@ func (patTest *PassAccessTokenTest) getCallbackEndpoint() (httpCode int, cookie
|
||||
// getEndpointWithCookie makes a requests againt the oauthproxy with passed requestPath
|
||||
// and cookie and returns body and status code.
|
||||
func (patTest *PassAccessTokenTest) getEndpointWithCookie(cookie string, endpoint string) (httpCode int, accessToken string) {
|
||||
cookieName := patTest.proxy.CookieOptions.Name
|
||||
cookieName := patTest.opts.Cookie.Name
|
||||
var value string
|
||||
keyPrefix := cookieName + "="
|
||||
|
||||
@ -750,9 +750,6 @@ func NewProcessCookieTest(opts ProcessCookieTestOpts, modifiers ...OptionsModifi
|
||||
}
|
||||
pcTest.proxy.provider.(*TestProvider).SetAllowedGroups(pcTest.opts.Providers[0].AllowedGroups)
|
||||
|
||||
// Now, zero-out proxy.CookieRefresh for the cases that don't involve
|
||||
// access_token validation.
|
||||
pcTest.proxy.CookieOptions.Refresh = time.Duration(0)
|
||||
pcTest.rw = httptest.NewRecorder()
|
||||
pcTest.req, _ = http.NewRequest("GET", "/", strings.NewReader(""))
|
||||
pcTest.validateUser = true
|
||||
@ -874,7 +871,6 @@ func TestProcessCookieFailIfRefreshSetAndCookieExpired(t *testing.T) {
|
||||
err = pcTest.SaveSession(startSession)
|
||||
assert.NoError(t, err)
|
||||
|
||||
pcTest.proxy.CookieOptions.Refresh = time.Hour
|
||||
session, err := pcTest.LoadCookiedSession()
|
||||
assert.NotEqual(t, nil, err)
|
||||
if session != nil {
|
||||
@ -1624,7 +1620,7 @@ func TestClearSplitCookie(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
p := OAuthProxy{CookieOptions: &opts.Cookie, sessionStore: store}
|
||||
p := OAuthProxy{sessionStore: store}
|
||||
var rw = httptest.NewRecorder()
|
||||
req := httptest.NewRequest("get", "/", nil)
|
||||
|
||||
@ -1657,7 +1653,7 @@ func TestClearSingleCookie(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
p := OAuthProxy{CookieOptions: &opts.Cookie, sessionStore: store}
|
||||
p := OAuthProxy{sessionStore: store}
|
||||
var rw = httptest.NewRecorder()
|
||||
req := httptest.NewRequest("get", "/", nil)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user