Skip to content

Commit f68fb9d

Browse files
committed
test: Make sure OIDC tests check relevant policies
1 parent 9b08f27 commit f68fb9d

1 file changed

Lines changed: 34 additions & 2 deletions

File tree

test/integration/Oidc.test.ts

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AlgJwk, App, CachedJwkGenerator, MemoryMapStorage } from '@solid/community-server';
1+
import { AlgJwk, App, CachedJwkGenerator, joinUrl, MemoryMapStorage } from '@solid/community-server';
22
import { setGlobalLoggerFactory, WinstonLoggerFactory } from 'global-logger-factory';
33
import { importJWK, SignJWT } from 'jose';
44
import { randomUUID } from 'node:crypto';
@@ -22,7 +22,7 @@ describe('A server supporting OIDC tokens', (): void => {
2222
const oidcFormat = 'http://openid.net/specs/openid-connect-core-1_0.html#IDToken';
2323

2424
beforeAll(async(): Promise<void> => {
25-
setGlobalLoggerFactory(new WinstonLoggerFactory('info'));
25+
setGlobalLoggerFactory(new WinstonLoggerFactory('off'));
2626

2727
umaApp = await instantiateFromConfig(
2828
'urn:uma:default:App',
@@ -157,6 +157,14 @@ describe('A server supporting OIDC tokens', (): void => {
157157
});
158158
expect(response.status).toBe(200);
159159
});
160+
161+
it('can remove the policy.', async(): Promise<void> => {
162+
const response = await fetch(joinUrl(policyEndpoint, encodeURIComponent('http://example.org/policyStandard')), {
163+
method: 'DELETE',
164+
headers: { authorization: `WebID ${encodeURIComponent(webId)}`, 'content-type': 'text/turtle' },
165+
});
166+
expect(response.status).toBe(204);
167+
});
160168
});
161169

162170
describe('accessing a resource using a standard OIDC token with a specific client.', (): void => {
@@ -225,6 +233,14 @@ describe('A server supporting OIDC tokens', (): void => {
225233
});
226234
expect(response.status).toBe(200);
227235
});
236+
237+
it('can remove the policy.', async(): Promise<void> => {
238+
const response = await fetch(joinUrl(policyEndpoint, encodeURIComponent('http://example.org/policyStandardClient')), {
239+
method: 'DELETE',
240+
headers: { authorization: `WebID ${encodeURIComponent(webId)}`, 'content-type': 'text/turtle' },
241+
});
242+
expect(response.status).toBe(204);
243+
});
228244
});
229245

230246
describe('accessing a resource using a Solid OIDC token.', (): void => {
@@ -278,6 +294,14 @@ describe('A server supporting OIDC tokens', (): void => {
278294
});
279295
expect(response.status).toBe(200);
280296
});
297+
298+
it('can remove the policy.', async(): Promise<void> => {
299+
const response = await fetch(joinUrl(policyEndpoint, encodeURIComponent('http://example.org/policySolid')), {
300+
method: 'DELETE',
301+
headers: { authorization: `WebID ${encodeURIComponent(webId)}`, 'content-type': 'text/turtle' },
302+
});
303+
expect(response.status).toBe(204);
304+
});
281305
});
282306

283307
describe('accessing a resource using a Solid OIDC token with a specific client.', (): void => {
@@ -348,5 +372,13 @@ describe('A server supporting OIDC tokens', (): void => {
348372
});
349373
expect(response.status).toBe(200);
350374
});
375+
376+
it('can remove the policy.', async(): Promise<void> => {
377+
const response = await fetch(joinUrl(policyEndpoint, encodeURIComponent('http://example.org/policySolidClient')), {
378+
method: 'DELETE',
379+
headers: { authorization: `WebID ${encodeURIComponent(webId)}`, 'content-type': 'text/turtle' },
380+
});
381+
expect(response.status).toBe(204);
382+
});
351383
});
352384
});

0 commit comments

Comments
 (0)