feat: Store account settings separately

Account settings are stored using the WebID as key.
Reason for using the WebID is that this allows faster access to the settings
in authenticated requests.
A consequence of this is that passwords are now always required during registration,
and that there can only be 1 account per WebID.
This commit is contained in:
Joachim Van Herwegen
2021-08-30 16:47:34 +02:00
parent f40e2c768f
commit 6c4ccb334d
11 changed files with 246 additions and 166 deletions

View File

@@ -53,6 +53,7 @@ describe('A Solid server with IDP', (): void => {
const oidcIssuer = baseUrl;
const card = joinUrl(baseUrl, 'profile/card');
const webId = `${card}#me`;
const webId2 = `${card}#someoneElse`;
const email = 'test@test.com';
const password = 'password!';
const password2 = 'password2!';
@@ -241,25 +242,32 @@ describe('A Solid server with IDP', (): void => {
});
});
describe('creating pods without registering', (): void => {
describe('creating pods without registering with the IDP', (): void => {
let formBody: string;
let registrationTriple: string;
const podName = 'myPod';
beforeAll(async(): Promise<void> => {
// We will need this twice
formBody = stringify({ email, webId, podName, createPod: 'ok' });
formBody = stringify({
email: 'bob@test.email',
webId: webId2,
password,
confirmPassword: password,
podName,
createPod: 'ok',
});
});
it('sends the form once to receive the registration triple.', async(): Promise<void> => {
const res = await postForm(`${baseUrl}idp/register`, formBody);
expect(res.status).toBe(400);
registrationTriple = extractRegistrationTriple(await res.text(), webId);
registrationTriple = extractRegistrationTriple(await res.text(), webId2);
});
it('updates the webId with the registration token.', async(): Promise<void> => {
const patchBody = `INSERT DATA { ${registrationTriple} }`;
const res = await fetch(webId, {
const res = await fetch(webId2, {
method: 'PATCH',
headers: { 'content-type': 'application/sparql-update' },
body: patchBody,