Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changelog/457746bef3eb4ef08b5b25548f5cf5d2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "457746be-f3eb-4ef0-8b5b-25548f5cf5d2",
"type": "feature",
"description": "Add Expires field to CookieOptions.",
"modules": [
"feature/cloudfront/sign"
]
}
4 changes: 4 additions & 0 deletions feature/cloudfront/sign/sign_cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
Loading