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

Injected auth models #1583

Merged
merged 66 commits into from
Jan 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
87a24b1
WIP: Auth entity
infomiho Nov 15, 2023
7749dec
Merge branch 'main' into auth-model-experiment
infomiho Nov 15, 2023
a7e3c14
Username and password working
infomiho Nov 15, 2023
bf77d11
Add support for email auth
infomiho Nov 15, 2023
238c3a8
Add support for Social auth
infomiho Nov 15, 2023
627ecf9
Add tasks to User
infomiho Nov 16, 2023
4259689
Update authentication providers and entities
infomiho Nov 24, 2023
20d4fd4
Email authentication. Test adding signup fields
infomiho Nov 24, 2023
33eb3aa
Migration with seed scripts
infomiho Nov 24, 2023
993e39d
Migrate Todo app
infomiho Nov 24, 2023
cf38191
Clenaup
infomiho Nov 27, 2023
9dfbd6c
Remove example app
infomiho Nov 27, 2023
4d0e3e4
Cleanup
infomiho Nov 27, 2023
a768c36
Updates tests
infomiho Nov 27, 2023
83ad555
Cleanup
infomiho Nov 27, 2023
8693c69
Fixes tests
infomiho Nov 28, 2023
43fb9f7
Merge branch 'main' into auth-model-experiment
infomiho Dec 12, 2023
e6f6a17
Use JSON based auth model
infomiho Dec 12, 2023
2714731
Refactor provider data serialization
infomiho Dec 12, 2023
872bca1
Updates typing of provider data
infomiho Dec 13, 2023
fd87def
Remove Prisma middleware. Fixes types
infomiho Dec 13, 2023
3ae0468
Cleanup
infomiho Dec 13, 2023
b5e0c05
Fixes double password hashing issue
infomiho Dec 13, 2023
315962f
Fixes headless test
infomiho Dec 13, 2023
95bda0a
Update e2e tests
infomiho Dec 13, 2023
efc2291
Cleanup
infomiho Dec 13, 2023
7fa0fe1
Merge branch 'main' into auth-model-experiment
infomiho Dec 14, 2023
21b0e77
Updates utils.ts. Updates websocket example app
infomiho Dec 14, 2023
f94f7fd
Update e2e tests
infomiho Dec 14, 2023
0a1d965
Update examples apps. Update server utils.ts
infomiho Dec 14, 2023
52f0881
PR comments
infomiho Dec 18, 2023
f982e6d
Updates e2e tests
infomiho Dec 18, 2023
48484c1
Add user ID helpers
infomiho Dec 18, 2023
6ba6a21
Fixes e2e tests
infomiho Dec 18, 2023
cf19e38
Improve naming and types
infomiho Dec 19, 2023
c5aee00
Updates e2e tests
infomiho Dec 19, 2023
a3cb241
Update examples/waspello/src/client/Navbar.jsx
infomiho Dec 19, 2023
b0b1a8b
PR comments
infomiho Dec 21, 2023
ce1c89b
PR comments
infomiho Dec 21, 2023
c3e46dc
Minor fixes. Rename local provider to username
infomiho Dec 22, 2023
c58ed9c
Updates e2e tests
infomiho Dec 22, 2023
2429673
Fixes frontend unit tests
infomiho Dec 22, 2023
d71d0f7
PR comments
infomiho Dec 22, 2023
8d27abb
Update e2e tests
infomiho Dec 22, 2023
d9690bb
Improve username handling in examples. Add getFirstProviderUserId
infomiho Dec 22, 2023
226e38b
Update e2e tests
infomiho Dec 22, 2023
9303dbc
Update seed script path
infomiho Dec 22, 2023
7ea4792
Add comment above PossibleProviderData
infomiho Dec 22, 2023
887ce20
Use UTC date for auth related timings
infomiho Dec 22, 2023
215bb86
Updates e2e tests
infomiho Dec 22, 2023
227a2f8
unverfiied email signup flow. foregin constraint error
infomiho Dec 23, 2023
1c53057
e2e tests
infomiho Dec 23, 2023
5daf665
Use token in email verification and password reset
infomiho Dec 23, 2023
4d1a863
e2e tests
infomiho Dec 23, 2023
dba9d28
Fix user creation and deletion errors
infomiho Dec 27, 2023
c313736
e2e tests
infomiho Dec 27, 2023
acf5d1f
PR comments
infomiho Dec 29, 2023
49966c0
PR comments
infomiho Jan 2, 2024
7c1b66e
Update e2e tests
infomiho Jan 2, 2024
04a9ee1
Extract the oauth handler into a separate function
infomiho Jan 2, 2024
d84dcc9
e2e tests
infomiho Jan 2, 2024
d4339a4
Update waspc/data/Generator/templates/server/src/auth/providers/email…
infomiho Jan 3, 2024
5077add
Apply suggestions from code review
infomiho Jan 3, 2024
9e4d7bb
Merge branch 'main' into auth-model-experiment
infomiho Jan 3, 2024
993eeac
PR comments
infomiho Jan 3, 2024
9b1185d
e2e tests
infomiho Jan 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleanup
infomiho committed Nov 27, 2023
commit 4d0e3e4fdd8608a9edf4ecab1534be6def979142
9 changes: 5 additions & 4 deletions waspc/src/Wasp/Generator/DbGenerator/Auth.hs
Martinsos marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -38,13 +38,14 @@ providersFieldOnAuthEntityName = "providers"
injectAuth :: Maybe (String, AS.Entity.Entity) -> [(String, AS.Entity.Entity)] -> Generator [(String, AS.Entity.Entity)]
Martinsos marked this conversation as resolved.
Show resolved Hide resolved
injectAuth Nothing entities = return entities
Martinsos marked this conversation as resolved.
Show resolved Hide resolved
injectAuth (Just (userEntityName, userEntity)) entities = do
userEntityIdType <- getUserEntityId userEntity
userEntityIdType <- getUserEntityIdType userEntity
authEntity <- makeAuthEntity userEntityIdType userEntityName
providerEntity <- makeProviderEntity
return $ injectAuthIntoUserEntity userEntityName $ entities ++ [authEntity, providerEntity]
let entitiesWithAuth = injectAuthIntoUserEntity userEntityName entities
return $ entitiesWithAuth ++ [authEntity, providerEntity]

getUserEntityId :: AS.Entity.Entity -> Generator String
getUserEntityId entity =
getUserEntityIdType :: AS.Entity.Entity -> Generator String
getUserEntityIdType entity =
show . Psl.Model.Field._type <$> AS.Entity.getIdField entity
& ( \case
Nothing -> logAndThrowGeneratorError $ GenericGeneratorError "User entity does not have an id field."
Martinsos marked this conversation as resolved.
Show resolved Hide resolved