Skip to content

Commit

Permalink
fix(amazon-cognito-identity-js): add "none" to sameSite possible valu…
Browse files Browse the repository at this point in the history
…es (aws-amplify#6682)

* add none to cookiesStorage sameSite possible values

* add sameSite = none to the valid values

* update ICookieStorageData interface

update ICookieStorageData to support sameSite = 'none'

* Update packages/amazon-cognito-identity-js/src/CookieStorage.js

Co-authored-by: Alex Hinson <alexmhinson@gmail.com>
  • Loading branch information
2 people authored and nubpro committed Oct 2, 2020
1 parent 2206ede commit 0e6a374
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/amazon-cognito-identity-js/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions packages/amazon-cognito-identity-js/src/CookieStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ export default class CookieStorage {
this.secure = true;
}
if (Object.prototype.hasOwnProperty.call(data, 'sameSite')) {
if (data.sameSite !== 'strict' && data.sameSite !== 'lax') {
if (!['strict','lax','none'].includes(data.sameSite)) {
throw new Error(
'The sameSite value of cookieStorage must be "lax" or "strict".'
'The sameSite value of cookieStorage must be "lax", "strict" or "none".'
);
}
if (data.sameSite === 'none' && !this.secure) {
throw new Error(
'sameSite = None requires the Secure attribute in latest browser versions.'
);
}
this.sameSite = data.sameSite;
Expand Down

0 comments on commit 0e6a374

Please sign in to comment.