mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-10-07 18:29:04 +02:00
fix: /authorize endpoint crashes when list of scopes is empty (#1575)
This commit is contained in:
@@ -74,6 +74,44 @@ test('Authorize client requesting offline_access scope', async ({ page }) => {
|
||||
expect(callbackUrl.searchParams.get('error')).toBeNull();
|
||||
});
|
||||
|
||||
test('Authorize existing client without scopes', async ({ page }) => {
|
||||
const oidcClient = oidcClients.nextcloud;
|
||||
const urlParams = new URLSearchParams({
|
||||
client_id: oidcClient.id,
|
||||
response_type: 'code',
|
||||
redirect_uri: oidcClient.callbackUrl,
|
||||
state: 'no-scope-state',
|
||||
nonce: 'no-scope-nonce'
|
||||
});
|
||||
|
||||
await expectCallbackRedirect(page, oidcClient.callbackUrl, () =>
|
||||
page.goto(`/authorize?${urlParams.toString()}`)
|
||||
);
|
||||
});
|
||||
|
||||
test('Authorize new client without scopes', async ({ page }) => {
|
||||
const oidcClient = oidcClients.immich;
|
||||
const urlParams = new URLSearchParams({
|
||||
client_id: oidcClient.id,
|
||||
response_type: 'code',
|
||||
redirect_uri: oidcClient.callbackUrl,
|
||||
state: 'no-scope-new-client',
|
||||
nonce: 'no-scope-new-nonce'
|
||||
});
|
||||
|
||||
await page.goto(`/authorize?${urlParams.toString()}`);
|
||||
|
||||
// With no scopes there is nothing to display, but the page should still allow sign-in
|
||||
await expect(page.getByRole('button', { name: 'Sign in' })).toBeVisible();
|
||||
|
||||
const callbackUrl = await expectCallbackRedirect(page, oidcClient.callbackUrl, () =>
|
||||
page.getByRole('button', { name: 'Sign in' }).click()
|
||||
);
|
||||
expect(callbackUrl.searchParams.get('code')).toBeTruthy();
|
||||
expect(callbackUrl.searchParams.get('error')).toBeNull();
|
||||
expect(callbackUrl.searchParams.get('state')).toBe('no-scope-new-client');
|
||||
});
|
||||
|
||||
test('Authorize new client while not signed in', async ({ page }) => {
|
||||
const oidcClient = oidcClients.immich;
|
||||
const urlParams = createUrlParams(oidcClient);
|
||||
|
||||
Reference in New Issue
Block a user