feat: Add required ACP headers

This commit is contained in:
Joachim Van Herwegen
2022-08-19 15:24:53 +02:00
parent f3e7a20800
commit fa1dee573e
8 changed files with 147 additions and 3 deletions

View File

@@ -118,4 +118,21 @@ describe.each(stores)('An LDP handler with ACP using %s', (name, { storeConfig,
response = await fetch(baseUrl);
expect(response.status).toBe(200);
});
it('returns the required Link headers.', async(): Promise<void> => {
const baseAcr = joinUrl(baseUrl, '.acr');
const response = await fetch(baseAcr, { method: 'OPTIONS' });
const linkHeaders = response.headers.get('link');
expect(linkHeaders).toContain('<http://www.w3.org/ns/solid/acp#AccessControlResource>; rel="type"');
expect(linkHeaders).toContain('<http://www.w3.org/ns/auth/acl#Read>; rel="http://www.w3.org/ns/solid/acp#grant"');
expect(linkHeaders).toContain('<http://www.w3.org/ns/auth/acl#Append>; rel="http://www.w3.org/ns/solid/acp#grant"');
expect(linkHeaders).toContain('<http://www.w3.org/ns/auth/acl#Write>; rel="http://www.w3.org/ns/solid/acp#grant"');
expect(linkHeaders).toContain('<http://www.w3.org/ns/auth/acl#Control>; rel="http://www.w3.org/ns/solid/acp#grant"');
expect(linkHeaders).toContain('<http://www.w3.org/ns/solid/acp#target>; rel="http://www.w3.org/ns/solid/acp#attribute"');
expect(linkHeaders).toContain('<http://www.w3.org/ns/solid/acp#agent>; rel="http://www.w3.org/ns/solid/acp#attribute"');
expect(linkHeaders).toContain('<http://www.w3.org/ns/solid/acp#client>; rel="http://www.w3.org/ns/solid/acp#attribute"');
expect(linkHeaders).toContain('<http://www.w3.org/ns/solid/acp#issuer>; rel="http://www.w3.org/ns/solid/acp#attribute"');
});
});

View File

@@ -4,20 +4,24 @@
"css:config/app/main/default.json",
"css:config/app/init/default.json",
"css:config/app/setup/disabled.json",
"css:config/http/handler/simple.json",
"css:config/http/middleware/no-websockets.json",
"css:config/http/server-factory/no-websockets.json",
"css:config/http/static/default.json",
"css:config/identity/access/public.json",
"css:config/identity/handler/default.json",
"css:config/identity/ownership/token.json",
"css:config/identity/pod/static.json",
"css:config/ldp/authentication/debug-auth-header.json",
"css:config/ldp/authorization/acp.json",
"css:config/ldp/handler/default.json",
"css:config/ldp/metadata-parser/default.json",
"css:config/ldp/metadata-writer/default.json",
"css:config/ldp/modes/default.json",
"css:config/storage/key-value/memory.json",
"css:config/storage/middleware/default.json",
"css:config/util/auxiliary/acr.json",
@@ -30,7 +34,7 @@
],
"@graph": [
{
"comment": "An HTTP server with only the LDP handler as HttpHandler and an unsecure authenticator.",
"comment": "An HTTP server with only the LDP handler as HttpHandler and an unsecure authenticator using ACP.",
"@id": "urn:solid-server:test:Instances",
"@type": "RecordObject",
"record": [