Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Session Cookie Support In Token Manager (copy) #694

Conversation

oleksandrpravosudko-okta
Copy link
Contributor

@oleksandrpravosudko-okta oleksandrpravosudko-okta commented Apr 19, 2021

Access and Id Token can now set as session cookies when using cookie storage

Copy of #591 with merge conflicts resolved.

Resolves: OKTA-367497

@oleksandrpravosudko-okta oleksandrpravosudko-okta force-pushed the jpspringall-okta-367497-session-cookie-support branch from 0bdd15e to 477a5a9 Compare April 20, 2021 08:26
@oleksandrpravosudko-okta oleksandrpravosudko-okta marked this pull request as ready for review April 20, 2021 15:26
if (typeof secure === 'undefined' || typeof sameSite === 'undefined') {
throw new AuthSdkError('storage.set: "secure" and "sameSite" options must be provided');
}
var cookieOptions: CookieOptions = {
var cookieOptions: SetCookieOptions = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the type here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like SetCookieOptions type is intended to be used when creating a cookie.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like just different names, we probably can remove one in the future. Now let's just keep what it is to avoid breaking changes.

@@ -20,7 +20,7 @@ import {
SimpleStorage,
StorageType,
BrowserStorageUtil,
CookieStorage
CookieStorage, SetCookieOptions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add in separate line

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like it should be CookieOptions

@oleksandrpravosudko-okta oleksandrpravosudko-okta force-pushed the jpspringall-okta-367497-session-cookie-support branch 2 times, most recently from 56a449e to 105ffe6 Compare April 20, 2021 15:59
@codecov-commenter
Copy link

codecov-commenter commented Apr 20, 2021

Codecov Report

Merging #694 (6bc393a) into master (9831eb1) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #694      +/-   ##
==========================================
+ Coverage   84.52%   84.53%   +0.01%     
==========================================
  Files          98       98              
  Lines        2824     2826       +2     
  Branches      573      575       +2     
==========================================
+ Hits         2387     2389       +2     
  Misses        437      437              
Impacted Files Coverage Δ
lib/TokenManager.ts 94.56% <ø> (ø)
lib/StorageManager.ts 100.00% <100.00%> (ø)
lib/browser/browserStorage.ts 93.98% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9831eb1...6bc393a. Read the comment docs.

@oleksandrpravosudko-okta oleksandrpravosudko-okta force-pushed the jpspringall-okta-367497-session-cookie-support branch from e0ae3fa to 35ae87c Compare April 21, 2021 16:57
CHANGELOG.md Outdated
@@ -1,5 +1,11 @@
# Changelog

## 5.1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have not published 5.0 yet. This feature can go with 5.0 release.

@@ -152,6 +152,18 @@ describe('browserStorage', () => {
sameSite: 'strictly fakey'
});
});

it('setItem: will call storage.set, passing sessionCookie, secure and sameSite options ', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the test that should have the title "but no sesssionCookie option"? It appears to be testing that the sessionCookie option is NOT passed through

Copy link
Contributor

@aarongranick-okta aarongranick-okta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments, overall looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants