-
-
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
Feat(authentication): username password provider #6052
Feat(authentication): username password provider #6052
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
cd1a28d
to
c9c22a4
Compare
if(service.__hooks?.onApplicationStart) { | ||
await service.__hooks.onApplicationStart() | ||
} |
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.
todo: I would suggest to start using the medusa app to start modules. you can see how we achieved that in the search pr https://github.com/medusajs/medusa/blob/7de35d84c889070f34dd18255000bb39fba06a72/packages/medusa-test-utils/src/init-modules.ts
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.
cc @olivermrbl
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.
I am not super happy about these service hooks. The consumer of a module service should never have to worry about the providers being created on load - even when using initialize.
However, this concern can be discussed and tackled separately from this PR.
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.
This is needed for modules that require something to be executed after all modules are loaded and the application is running.
It was originally created at the index/search module where it reads all the exported joiner configs of loaded modules.
This is not executed by the consumer of the modules. MedusaApp calls it after it has completed loading everything.
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.
As we discussed a few times, at some point we need to normalize all entrypoints to be MedusaApp, and discourage the use of initialize
directly
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
if (password_hash && typeof password_hash === "string") { | ||
const buf = Buffer.from(password_hash, "base64") | ||
|
||
const success = await Scrypt.verify(buf, password) |
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: experiment running that with worker_threads
(it doesn't have to be in this PR)
b57fde1
to
5bf05cc
Compare
provider: provider.PROVIDER, | ||
name: provider.DISPLAY_NAME, | ||
}) | ||
function asArray( |
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.
question: Seems off to place a generic util like this here
@@ -0,0 +1,15 @@ | |||
import { Migration } from '@mikro-orm/migrations'; |
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.
comment: You should be able to omit the migration entirely until we have finalized the module. The tests will read the models and do not depend on migration files.
|
||
type OptionalFields = "provider_metadata" | "app_metadata" | "user_metadata" | ||
|
||
@Entity() | ||
@Unique({ properties: ["provider","entity_id" ], name: "IDX_auth_user_provider_entity_id" }) |
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.
question: Does this need linting?
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
No description provided.