fix: Expose Www-Authenticate via CORS

To support reactive authentication where clients inspect the challenge to choose an authentication mechanism.
This commit is contained in:
Samu Lang 2022-11-07 08:45:52 +01:00 committed by GitHub
parent 7fafd646fc
commit 60718a123d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -26,7 +26,8 @@
"Link", "Link",
"Location", "Location",
"Updates-Via", "Updates-Via",
"WAC-Allow" "WAC-Allow",
"Www-Authenticate"
] ]
} }
] ]

View File

@ -133,6 +133,12 @@ describe('An http server with middleware', (): void => {
expect(splitCommaSeparated(exposed)).toContain('Updates-Via'); expect(splitCommaSeparated(exposed)).toContain('Updates-Via');
}); });
it('exposes the Www-Authenticate header via CORS.', async(): Promise<void> => {
const res = await request(server).get('/').expect(200);
const exposed = res.header['access-control-expose-headers'];
expect(splitCommaSeparated(exposed)).toContain('Www-Authenticate');
});
it('sends incoming requests to the handler.', async(): Promise<void> => { it('sends incoming requests to the handler.', async(): Promise<void> => {
const response = request(server).get('/').set('Host', 'test.com'); const response = request(server).get('/').set('Host', 'test.com');
expect(response).toBeDefined(); expect(response).toBeDefined();