diff --git a/.changelog/457746bef3eb4ef08b5b25548f5cf5d2.json b/.changelog/457746bef3eb4ef08b5b25548f5cf5d2.json new file mode 100644 index 00000000000..29078007b03 --- /dev/null +++ b/.changelog/457746bef3eb4ef08b5b25548f5cf5d2.json @@ -0,0 +1,8 @@ +{ + "id": "457746be-f3eb-4ef0-8b5b-25548f5cf5d2", + "type": "feature", + "description": "Add Expires field to CookieOptions.", + "modules": [ + "feature/cloudfront/sign" + ] +} \ No newline at end of file diff --git a/feature/cloudfront/sign/sign_cookie.go b/feature/cloudfront/sign/sign_cookie.go index b35b93a9f2e..7e6d9aa1e5d 100644 --- a/feature/cloudfront/sign/sign_cookie.go +++ b/feature/cloudfront/sign/sign_cookie.go @@ -24,6 +24,7 @@ type CookieOptions struct { Domain string Secure bool SameSite http.SameSite + Expires time.Time } // apply will integration the options provided into the base cookie options @@ -219,16 +220,19 @@ func createCookies(p *Policy, keyID string, privKey *rsa.PrivateKey, opt CookieO Name: CookiePolicyName, Value: string(b64Policy), HttpOnly: true, + Expires: opt.Expires, } cSignature := &http.Cookie{ Name: CookieSignatureName, Value: string(b64Sig), HttpOnly: true, + Expires: opt.Expires, } cKey := &http.Cookie{ Name: CookieKeyIDName, Value: keyID, HttpOnly: true, + Expires: opt.Expires, } cookies := []*http.Cookie{cPolicy, cSignature, cKey}