Integrate cookie builder with persistent session manager

This commit is contained in:
Joel Speed
2021-10-06 14:56:56 +01:00
committed by Joel Speed
parent 93026e4c82
commit 2dcda8539c
8 changed files with 80 additions and 93 deletions
+3 -3
View File
@@ -11,7 +11,6 @@ import (
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
sessionsapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/sessions"
cookiesapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/cookies"
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/encryption"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -383,9 +382,10 @@ func SessionStoreInterfaceTests(in *testInput) {
BeforeEach(func() {
By("Using a valid cookie with a different providers session encoding")
broken := "BrokenSessionFromADifferentSessionImplementation"
value, err := encryption.SignedValue(in.cookieOpts.Secret, in.cookieOpts.Name, []byte(broken), time.Now())
cookieBuilder := cookiesapi.NewBuilder(*in.cookieOpts)
cookie, err := cookieBuilder.MakeCookie(in.request, broken)
Expect(err).ToNot(HaveOccurred())
cookie := cookiesapi.MakeCookieFromOptions(in.request, in.cookieOpts.Name, value, in.cookieOpts, in.cookieOpts.Expire, time.Now())
in.request.AddCookie(cookie)
err = in.ss().Save(in.response, in.request, in.session)