mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Support acl authorization for IDP components
Configuration has been updated so the IDP requests also pass through an Authorization component. A new config option was added to choose which authorization scheme to use for the IDP.
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
import { CredentialGroup } from '../../../src/authentication/Credentials';
|
||||
import { EmptyCredentialsExtractor } from '../../../src/authentication/EmptyCredentialsExtractor';
|
||||
import type { HttpRequest } from '../../../src/server/HttpRequest';
|
||||
import { NotImplementedHttpError } from '../../../src/util/errors/NotImplementedHttpError';
|
||||
|
||||
describe('An EmptyCredentialsExtractor', (): void => {
|
||||
const extractor = new EmptyCredentialsExtractor();
|
||||
|
||||
it('throws an error if an Authorization header is specified.', async(): Promise<void> => {
|
||||
const headers = { authorization: 'Other http://alice.example/card#me' };
|
||||
const result = extractor.handleSafe({ headers } as HttpRequest);
|
||||
await expect(result).rejects.toThrow(NotImplementedHttpError);
|
||||
await expect(result).rejects.toThrow('Unexpected Authorization scheme.');
|
||||
});
|
||||
|
||||
it('returns the empty credentials.', async(): Promise<void> => {
|
||||
const headers = {};
|
||||
const result = extractor.handleSafe({ headers } as HttpRequest);
|
||||
await expect(result).resolves.toEqual({ [CredentialGroup.public]: {}});
|
||||
});
|
||||
});
|
||||
13
test/unit/authentication/PublicCredentialsExtractor.test.ts
Normal file
13
test/unit/authentication/PublicCredentialsExtractor.test.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { CredentialGroup } from '../../../src/authentication/Credentials';
|
||||
import { PublicCredentialsExtractor } from '../../../src/authentication/PublicCredentialsExtractor';
|
||||
import type { HttpRequest } from '../../../src/server/HttpRequest';
|
||||
|
||||
describe('A PublicCredentialsExtractor', (): void => {
|
||||
const extractor = new PublicCredentialsExtractor();
|
||||
|
||||
it('returns the empty credentials.', async(): Promise<void> => {
|
||||
const headers = {};
|
||||
const result = extractor.handleSafe({ headers } as HttpRequest);
|
||||
await expect(result).resolves.toEqual({ [CredentialGroup.public]: {}});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user