mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Encode WebID ownership tokens
This commit is contained in:
parent
4e7929f6d2
commit
277a0d0ab7
@ -51,7 +51,7 @@ export class TokenOwnershipValidator extends OwnershipValidator {
|
||||
* Creates a key to use with the token storage.
|
||||
*/
|
||||
private getTokenKey(webId: string): string {
|
||||
return `ownershipToken${webId}`;
|
||||
return encodeURIComponent(webId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,15 +6,27 @@ import type { ResourceStore } from '../../src/storage/ResourceStore';
|
||||
import { APPLICATION_X_WWW_FORM_URLENCODED } from '../../src/util/ContentTypes';
|
||||
import { joinUrl } from '../../src/util/PathUtil';
|
||||
import { getPort } from '../util/Util';
|
||||
import { getDefaultVariables, getTestConfigPath, instantiateFromConfig } from './Config';
|
||||
import { getDefaultVariables, getTestConfigPath, getTestFolder, instantiateFromConfig, removeFolder } from './Config';
|
||||
|
||||
const port = getPort('Accounts');
|
||||
const baseUrl = `http://localhost:${port}/`;
|
||||
|
||||
const rootFilePath = getTestFolder('Accounts');
|
||||
const stores: [string, any][] = [
|
||||
[ 'in-memory storage', {
|
||||
config: 'memory-pod.json',
|
||||
teardown: jest.fn(),
|
||||
}],
|
||||
[ 'on-disk storage', {
|
||||
config: 'file-pod.json',
|
||||
teardown: async(): Promise<void> => removeFolder(rootFilePath),
|
||||
}],
|
||||
];
|
||||
|
||||
// Don't send actual e-mails
|
||||
jest.mock('nodemailer');
|
||||
|
||||
describe('A server with account management', (): void => {
|
||||
describe.each(stores)('A server with account management using %s', (name, { config, teardown }): void => {
|
||||
let app: App;
|
||||
let store: ResourceStore;
|
||||
let sendMail: jest.Mock;
|
||||
@ -42,8 +54,11 @@ describe('A server with account management', (): void => {
|
||||
|
||||
const instances = await instantiateFromConfig(
|
||||
'urn:solid-server:test:Instances',
|
||||
getTestConfigPath('memory-pod.json'),
|
||||
getDefaultVariables(port, baseUrl),
|
||||
getTestConfigPath(config),
|
||||
{
|
||||
...getDefaultVariables(port, baseUrl),
|
||||
'urn:solid-server:default:variable:rootFilePath': rootFilePath,
|
||||
},
|
||||
) as Record<string, any>;
|
||||
({ app, store } = instances);
|
||||
await app.start();
|
||||
@ -68,6 +83,7 @@ describe('A server with account management', (): void => {
|
||||
});
|
||||
|
||||
afterAll(async(): Promise<void> => {
|
||||
await teardown();
|
||||
await app.stop();
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user