-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix(medusa): Separate JWT auth strategies per domain #2646
Conversation
🦋 Changeset detectedLatest commit: f9525ba The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
/snapshot-this |
/snapshot-this |
🚀 A snapshot release has been made for this PRTest the snapshots by updating your yarn add @medusajs/medusa@0.0.0-snapshot-20221121194915 yarn add medusa-core-utils@0.0.0-snapshot-20221121194915
|
/snapshot-this |
🚀 A snapshot release has been made for this PRTest the snapshots by updating your yarn add @medusajs/medusa@0.0.0-snapshot-20221121211122 yarn add medusa-core-utils@0.0.0-snapshot-20221121211122
|
/snapshot-this |
🚀 A snapshot release has been made for this PRTest the snapshots by updating your yarn add @medusajs/medusa@0.0.0-snapshot-20221121213619 yarn add medusa-core-utils@0.0.0-snapshot-20221121213619
|
33e49e2
to
38a60bd
Compare
/snapshot-this |
🚀 A snapshot release has been made for this PRTest the snapshots by updating your yarn add @medusajs/medusa@0.0.0-snapshot-20221121224430 yarn add medusa-core-utils@0.0.0-snapshot-20221121224430
|
/snapshot-this |
🚀 A snapshot release has been made for this PRTest the snapshots by updating your yarn add @medusajs/medusa@0.0.0-snapshot-20221121230632 yarn add medusa-core-utils@0.0.0-snapshot-20221121230632
|
e9f6af0
to
c7bca61
Compare
/snapshot-this |
417c426
to
24317f7
Compare
ea83b19
to
91265b8
Compare
91265b8
to
a1d6646
Compare
/snapshot-this |
🚀 A snapshot release has been made for this PRTest the snapshots by updating your yarn add @medusajs/medusa@0.0.0-snapshot-20221122082111 yarn add medusa-core-utils@0.0.0-snapshot-20221122082111
|
|
||
export default { | ||
authenticate, | ||
authenticateCustomer, | ||
authenticateCustomerOrThrow, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: requireAuthenticateCustomer
just to avoid confusion for the consumer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉 just a little suggestion non blocking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests need to be updated the reflect the auth changes 🚀
@adrien2p done 😎 |
perfect 🚀 it looks like we've done it 😍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
import passport from "passport" | ||
|
||
export default (): RequestHandler => { | ||
return (req: Request, res: Response, next: NextFunction): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought(non-blocking): when this is called the authenticateCustomer
middleware will already be applied. This means the JWT is parsed. We could just verify with a simple if
that the customer has been parsed. Not an important change but just wanted to highlight that this might be duplicate work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I would just say that a user could use them independently and therefore I am not sure we should go with the idea that we know that internally it has already been parsed. Wdyt?
**What** Separate JWT auth strategies per domain Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com> Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
What
Separate JWT auth strategies per domain