@@ -4,6 +4,7 @@ import (
44 "crypto/rand"
55 "net/http"
66 "net/http/httptest"
7+ "os"
78 "strconv"
89 "strings"
910 "time"
@@ -133,6 +134,42 @@ func RunSessionStoreTests(newSS NewSessionStoreFunc, persistentFastForward Persi
133134 PersistentSessionStoreInterfaceTests(&input)
134135 }
135136 })
137+
138+ Context("with cookie secret file", func() {
139+ var tmpfile *os.File
140+ var err error
141+ BeforeEach(func() {
142+ tmpfile, err = os.CreateTemp("", "cookie-secret-test")
143+ secretBytes := make([]byte, 32)
144+ tmpfile.Write(secretBytes)
145+ tmpfile.Close()
146+
147+ input.cookieOpts = &options.Cookie{
148+ Name: "_oauth2_proxy_file",
149+ Path: "/",
150+ Expire: time.Duration(168) * time.Hour,
151+ Refresh: time.Duration(1) * time.Hour,
152+ Secure: true,
153+ HTTPOnly: true,
154+ SameSite: "",
155+ Secret: "",
156+ SecretFile: tmpfile.Name(),
157+ }
158+ ss, err = newSS(opts, input.cookieOpts)
159+ Expect(err).ToNot(HaveOccurred())
160+ })
161+
162+ AfterEach(func() {
163+ if tmpfile != nil {
164+ os.Remove(tmpfile.Name())
165+ }
166+ })
167+
168+ SessionStoreInterfaceTests(&input)
169+ if persistentFastForward != nil {
170+ PersistentSessionStoreInterfaceTests(&input)
171+ }
172+ })
136173 })
137174}
138175