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

feat: moving cookie related logic to cookieAdapter.ts #42

Merged

Conversation

BibiSebi
Copy link
Contributor

@BibiSebi BibiSebi commented Jul 8, 2024

What?

This PR

  • moves all logic from internal Adapter to the public one (in this case cookieAdapter)
  • removes yarn files
  • fixes inferSessionQuery

Why?

To reduce complexity of the underlying abstraction layers, it makes sense to move the responsibility of the implementation to the upper highest level - in this scenario cookieAdapter. In future there will be other adapters living on the same level as cookieAdapter which can be used interchangeably. The consumption of adapter is done inside app-extension-auth however the specific details on which structure to store the session in or how to encode and decode should be in the hands of the public adapter (e.g.: cookieAdapter, or in future other adapters)

@BibiSebi BibiSebi force-pushed the SHAPE-5999-showcase-extracting-logic-to-public-adapter branch from fd84bc8 to 2138fca Compare July 8, 2024 11:49
@@ -19,41 +20,49 @@ const createScopedKey = ({
// We do not use `clientId` in cookie adapter,
// because different plugins will have different domain names,
// and it's enough to differentiate these cookie values.

const sessionKey = 'sb.auth'
//NOTE: possibly cookieAdapter can become createCookieAdapter(key: string)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

WDYT about this comment @eunjae-lee ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if you agree with this I will also need to change a bit the docs (just a note for myself)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah agree with create... naming

Copy link
Contributor Author

Choose a reason for hiding this comment

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

on it

Copy link
Contributor Author

@BibiSebi BibiSebi Jul 11, 2024

Choose a reason for hiding this comment

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

Done ff31f67

@BibiSebi BibiSebi force-pushed the SHAPE-5999-showcase-extracting-logic-to-public-adapter branch from 2367d42 to 474cc58 Compare July 9, 2024 06:58
@BibiSebi BibiSebi requested a review from eunjae-lee July 9, 2024 14:10
@BibiSebi BibiSebi marked this pull request as ready for review July 9, 2024 14:43
@@ -12,7 +12,7 @@ export const changedCookieHeaderValue = (
return [
`${name}=${value}`,
'path=/',
expires ? `Expires=${expires.toISOString()}; ` : undefined,
expires ? `Expires=${expires}; ` : undefined,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eunjae-lee I changes this because it did not work for me and the expires attribute was set to Session, now it seems to work. Please could you double-check?

image

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right. I've just confirmed it!

BibiSebi added 2 commits July 11, 2024 11:42
…e able to pass custom sessionKey

- minor function extraction for better readability
@eunjae-lee eunjae-lee merged commit 2e0885b into main Jul 15, 2024
1 check passed
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.

2 participants