mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-10-12 20:59:04 +02:00
feat: add ability to customize session duration of clients (#1641)
This commit is contained in:
@@ -5,6 +5,11 @@ import { generateIdToken } from '../utils/jwt.util';
|
||||
import * as oidcUtil from '../utils/oidc.util';
|
||||
import passkeyUtil from '../utils/passkey.util';
|
||||
|
||||
const defaultTokenLifetimes = {
|
||||
accessTokenDurationMinutes: 60,
|
||||
refreshTokenDurationMinutes: 30 * 24 * 60
|
||||
};
|
||||
|
||||
test.beforeEach(async () => await cleanupBackend());
|
||||
|
||||
async function generateSeededOauthAccessToken(
|
||||
@@ -760,6 +765,7 @@ test('Device authorization flow forces reauthentication when client requires it'
|
||||
const client = oidcClients.nextcloud;
|
||||
await request.put(`/api/oidc/clients/${client.id}`, {
|
||||
data: {
|
||||
...defaultTokenLifetimes,
|
||||
name: client.name,
|
||||
callbackURLs: [client.callbackUrl],
|
||||
logoutCallbackURLs: [client.logoutCallbackUrl],
|
||||
@@ -885,6 +891,7 @@ test('Forces reauthentication when client requires it', async ({ page, request }
|
||||
|
||||
await request.put(`/api/oidc/clients/${oidcClients.nextcloud.id}`, {
|
||||
data: {
|
||||
...defaultTokenLifetimes,
|
||||
name: oidcClients.nextcloud.name,
|
||||
callbackURLs: [oidcClients.nextcloud.callbackUrl],
|
||||
logoutCallbackURLs: [oidcClients.nextcloud.logoutCallbackUrl],
|
||||
@@ -1438,6 +1445,7 @@ test.describe('Pushed Authorization Requests (PAR)', () => {
|
||||
await page.request.put(`/api/oidc/clients/${client.id}`, {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: {
|
||||
...defaultTokenLifetimes,
|
||||
name: client.name,
|
||||
callbackURLs: [client.callbackUrl],
|
||||
logoutCallbackURLs: [],
|
||||
@@ -1481,6 +1489,7 @@ test.describe('Pushed Authorization Requests (PAR)', () => {
|
||||
await request.put(`/api/oidc/clients/${client.id}`, {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: {
|
||||
...defaultTokenLifetimes,
|
||||
name: client.name,
|
||||
callbackURLs: [client.callbackUrl],
|
||||
logoutCallbackURLs: [],
|
||||
@@ -1514,7 +1523,7 @@ test.describe('Pushed Authorization Requests (PAR)', () => {
|
||||
await parToggle.click();
|
||||
}
|
||||
|
||||
await page.getByRole('button', { name: /save/i }).click();
|
||||
await page.getByRole('button', { name: 'Save', exact: true }).first().click();
|
||||
await expect(page.getByText('OIDC client updated successfully', { exact: true })).toBeVisible();
|
||||
await page.reload();
|
||||
|
||||
@@ -1564,7 +1573,8 @@ test.describe('OIDC skip consent', () => {
|
||||
// Disabling it and saving must persist across a reload
|
||||
await toggle.click();
|
||||
await expect(toggle).not.toBeChecked();
|
||||
await page.getByRole('button', { name: /save/i }).click();
|
||||
const clientForm = toggle.locator('xpath=ancestor::form');
|
||||
await clientForm.getByRole('button', { name: 'Save', exact: true }).click();
|
||||
await expect(page.getByText('OIDC client updated successfully', { exact: true })).toBeVisible();
|
||||
await page.reload();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user