-
Notifications
You must be signed in to change notification settings - Fork 0
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: save synapse token in memory instead of mongoDB #320
Merged
Junjiequan
merged 32 commits into
master
from
SWAP-3202-scicat-fe-investigate-why-logbook-under-proposal
Sep 20, 2023
Merged
Changes from 6 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
98971c2
fix: removed synapse createRoom and createUser services
Junjiequan 075eed3
fix: remove createRoom and createUser service
Junjiequan 4e3f998
ignore: format reset
Junjiequan 8f1ebed
fix: removed rabbit-mq observer
Junjiequan e244cd5
TODO: 2 todos included.
Junjiequan f8ee7f1
fix: removed unnecessary files & saving token in memory
Junjiequan 719392c
fix: minor cleanup
Junjiequan d36c149
test
Junjiequan 74cc824
test2
Junjiequan 746d987
test3
Junjiequan baa6bcc
fix: added endpoint to check whether token should be renewed
Junjiequan 933b106
fix: test fail fix
Junjiequan 01a3f54
fix: test fix
Junjiequan 7373a1f
test
Junjiequan f93a87e
test
Junjiequan d416492
test
Junjiequan 6982e36
test
Junjiequan fa251fd
test
Junjiequan 0b3e923
test
Junjiequan 4058dfe
test2
Junjiequan fb2d055
test
Junjiequan 5c340d6
test
Junjiequan 848e08e
test - synapse.service.ts
Junjiequan d2f907a
test2
Junjiequan f16a933
test
Junjiequan 98ff92c
testing - test pass
Junjiequan 49ac4fd
fix: removed acceptance testing
Junjiequan 12b6f3e
fix: removed mongoDB, updated ReadMe and cleaned up ENV files
Junjiequan b2d736c
fix: test fail fix
Junjiequan d2c9adb
fix: test fix
Junjiequan 0666411
fix: home-page acceptance fix
Junjiequan ac0be9d
fix: remove env from github job
Junjiequan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,5 @@ | ||
import { genSalt, hash } from "bcryptjs"; | ||
import { MongodbDataSource } from "../datasources"; | ||
import { Logbook, SynapseToken, User, UserCredentials } from "../models"; | ||
import { UserCredentialsRepository, UserRepository } from "../repositories"; | ||
import { Logbook, SynapseToken } from "../models"; | ||
import { SynapseSyncResponse } from "../services"; | ||
import { testdbConfig } from "./fixtures/datasources/testdb.datasource"; | ||
|
||
const testdb = new MongodbDataSource(testdbConfig); | ||
const userRepository = new UserRepository( | ||
testdb, | ||
async () => userCredentialsRepository, | ||
); | ||
const userCredentialsRepository = new UserCredentialsRepository(testdb); | ||
|
||
export async function givenEmptyDatabase() { | ||
await userRepository.deleteAll(); | ||
await userCredentialsRepository.deleteAll(); | ||
} | ||
|
||
export function givenUserData(data?: Partial<User>) { | ||
return Object.assign( | ||
{ | ||
username: "testUser", | ||
email: "[email protected]", | ||
}, | ||
data, | ||
); | ||
} | ||
|
||
export async function givenUser(data?: Partial<User>) { | ||
return userRepository.create(givenUserData(data)); | ||
} | ||
|
||
export async function givenUserCredentialsData( | ||
data?: Partial<UserCredentials>, | ||
) { | ||
return Object.assign( | ||
{ | ||
password: await hash("password", await genSalt()), | ||
}, | ||
data, | ||
); | ||
} | ||
|
||
export async function givenUserCredentials(data?: Partial<UserCredentials>) { | ||
return userCredentialsRepository.create(await givenUserCredentialsData(data)); | ||
} | ||
|
||
export async function givenUserAccount() { | ||
const user = await givenUser(); | ||
return givenUserCredentials({ userId: user.id }); | ||
} | ||
|
||
export function givenCredentials() { | ||
return { username: "testUser", password: "password" }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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. Why was this test removed?
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.
After refactoring JWT validation is no longer needed so is for the JWT test.
Within this PR synapse credential will be directly passed to loopback from SciCat BE, then loopback will use the credential to login Synapse server and save generated token in the memory.