feat(backend/oauth): allow CORS for token endpoint (#12814)
* feat(backend/oauth): allow CORS for token endpoint * no need to explicitly set origin to `*` * Update CHANGELOG.md
This commit is contained in:
parent
c96bc36fed
commit
ad346b6f36
10 changed files with 242 additions and 48 deletions
|
@ -941,4 +941,24 @@ describe('OAuth', () => {
|
|||
const response = await fetch(new URL('/oauth/foo', host));
|
||||
assert.strictEqual(response.status, 404);
|
||||
});
|
||||
|
||||
describe('CORS', () => {
|
||||
test('Token endpoint should support CORS', async () => {
|
||||
const response = await fetch(new URL('/oauth/token', host), { method: 'POST' });
|
||||
assert.ok(!response.ok);
|
||||
assert.strictEqual(response.headers.get('Access-Control-Allow-Origin'), '*');
|
||||
});
|
||||
|
||||
test('Authorize endpoint should not support CORS', async () => {
|
||||
const response = await fetch(new URL('/oauth/authorize', host), { method: 'GET' });
|
||||
assert.ok(!response.ok);
|
||||
assert.ok(!response.headers.has('Access-Control-Allow-Origin'));
|
||||
});
|
||||
|
||||
test('Decision endpoint should not support CORS', async () => {
|
||||
const response = await fetch(new URL('/oauth/decision', host), { method: 'POST' });
|
||||
assert.ok(!response.ok);
|
||||
assert.ok(!response.headers.has('Access-Control-Allow-Origin'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue