@@ -87,7 +87,7 @@ var _ = Describe("Cookie Tests", func() {
8787 opts options.Cookie
8888 expiration time.Duration
8989 now time.Time
90− expectedOutput time.Time
90+ expectedOutput int
9191 }
9292
9393 validName := "_oauth2_proxy"
@@ -95,7 +95,7 @@ var _ = Describe("Cookie Tests", func() {
9595 domains := []string{"www.cookies.test"}
9696
9797 now := time.Now()
98− var expectedExpires time.Time
98+ var expectedMaxAge int
9999
100100 DescribeTable("should return cookies with or without expiration",
101101 func(in makeCookieFromOptionsTableInput) {
@@ -106,7 +106,7 @@ var _ = Describe("Cookie Tests", func() {
106106 )
107107 Expect(err).ToNot(HaveOccurred())
108108
109− Expect(MakeCookieFromOptions(req, in.name, in.value, &in.opts, in.expiration, in.now).Expires).To(Equal(in.expectedOutput))
109+ Expect(MakeCookieFromOptions(req, in.name, in.value, &in.opts, in.expiration).MaxAge).To(Equal(in.expectedOutput))
110110 },
111111 Entry("persistent cookie", makeCookieFromOptionsTableInput{
112112 host: "www.cookies.test",
@@ -125,7 +125,26 @@ var _ = Describe("Cookie Tests", func() {
125125 },
126126 expiration: 15 * time.Minute,
127127 now: now,
128− expectedOutput: now.Add(15 * time.Minute),
128+ expectedOutput: int((15 * time.Minute).Seconds()),
129+ }),
130+ Entry("persistent cookie to be cleared", makeCookieFromOptionsTableInput{
131+ host: "www.cookies.test",
132+ name: validName,
133+ value: "1",
134+ opts: options.Cookie{
135+ Name: validName,
136+ Secret: validSecret,
137+ Domains: domains,
138+ Path: "",
139+ Expire: time.Hour * -1,
140+ Refresh: 15 * time.Minute,
141+ Secure: true,
142+ HTTPOnly: false,
143+ SameSite: "",
144+ },
145+ expiration: time.Hour * -1,
146+ now: now,
147+ expectedOutput: -1,
129148 }),
130149 Entry("session cookie", makeCookieFromOptionsTableInput{
131150 host: "www.cookies.test",
@@ -144,7 +163,7 @@ var _ = Describe("Cookie Tests", func() {
144163 },
145164 expiration: 0,
146165 now: now,
147− expectedOutput: expectedExpires,
166+ expectedOutput: expectedMaxAge,
148167 }),
149168 )
150169 })