feat: Update Credentials typings to support client/issuer

This commit is contained in:
Joachim Van Herwegen
2022-08-19 14:11:20 +02:00
parent 40f2c8ea42
commit f3e7a20800
48 changed files with 286 additions and 249 deletions

View File

@@ -1,4 +1,3 @@
import { CredentialGroup } from '../../../src/authentication/Credentials';
import { UnsecureWebIdExtractor } from '../../../src/authentication/UnsecureWebIdExtractor';
import type { HttpRequest } from '../../../src/server/HttpRequest';
import { NotImplementedHttpError } from '../../../src/util/errors/NotImplementedHttpError';
@@ -23,12 +22,12 @@ describe('An UnsecureWebIdExtractor', (): void => {
it('returns the authorization header as WebID if specified.', async(): Promise<void> => {
const headers = { authorization: 'WebID http://alice.example/card#me' };
const result = extractor.handleSafe({ headers } as HttpRequest);
await expect(result).resolves.toEqual({ [CredentialGroup.agent]: { webId: 'http://alice.example/card#me' }});
await expect(result).resolves.toEqual({ agent: { webId: 'http://alice.example/card#me' }});
});
it('returns the authorization header as WebID if specified with a lowercase token.', async(): Promise<void> => {
const headers = { authorization: 'webid http://alice.example/card#me' };
const result = extractor.handleSafe({ headers } as HttpRequest);
await expect(result).resolves.toEqual({ [CredentialGroup.agent]: { webId: 'http://alice.example/card#me' }});
await expect(result).resolves.toEqual({ agent: { webId: 'http://alice.example/card#me' }});
});
});