feat: Move WAC-Allow metadata collecting to HTTP handler

This depends on all auth related handlers to cache their results.
This allows us to remove the permission field from Operation.
This commit is contained in:
Joachim Van Herwegen
2022-11-18 10:54:19 +01:00
parent 59e64a22ea
commit 6ad5c0c797
16 changed files with 218 additions and 176 deletions

View File

@@ -15,7 +15,7 @@ import { IdentifierMap, IdentifierSetMultiMap } from '../../../src/util/map/Iden
describe('An AuthorizingHttpHandler', (): void => {
const credentials = { };
const target = { path: 'http://test.com/foo' };
const target = { path: 'http://example.com/foo' };
const requestedModes: AccessMap = new IdentifierSetMultiMap<AccessMode>([[ target, AccessMode.read ]]);
const availablePermissions: PermissionMap = new IdentifierMap(
[[ target, { public: { read: true }}]],
@@ -71,7 +71,6 @@ describe('An AuthorizingHttpHandler', (): void => {
expect(authorizer.handleSafe).toHaveBeenLastCalledWith({ credentials, requestedModes, availablePermissions });
expect(source.handleSafe).toHaveBeenCalledTimes(1);
expect(source.handleSafe).toHaveBeenLastCalledWith({ request, response, operation });
expect(operation.availablePermissions).toBe(availablePermissions);
});
it('errors if authorization fails.', async(): Promise<void> => {