mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Accept lowercase Authorization tokens.
This commit is contained in:
@@ -20,9 +20,15 @@ describe('An UnsecureWebIdExtractor', (): void => {
|
||||
await expect(result).rejects.toThrow('No WebID Authorization header specified.');
|
||||
});
|
||||
|
||||
it('returns the authorization header as WebID if there is one.', async(): Promise<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' }});
|
||||
});
|
||||
|
||||
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' }});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user