dh-auth-library 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,9 @@
1
1
  import { AuthType } from '../constants/authTypes';
2
2
  import { LoginHandler } from './loginHandler';
3
- export declare function getLoginHandler(authType: AuthType): LoginHandler;
3
+ /**
4
+ * @param authType type of login
5
+ * @param adTargetUrl URL to navigate to before logging in for the `ad-session` auth type (the
6
+ * app behind the firewall), supplied by the consumer of this library. Required when
7
+ * `authType` is `'ad-session'`, ignored otherwise.
8
+ */
9
+ export declare function getLoginHandler(authType: AuthType, adTargetUrl?: string): LoginHandler;
@@ -1,2 +1,8 @@
1
1
  import { TestProfile } from '../constants';
2
- export declare function getSessionHandler(testProfile: TestProfile): import("nl-portal-playwright-libraries").SessionHandler;
2
+ /**
3
+ * @param testProfile
4
+ * @param adTargetUrl URL to navigate to before logging in when `testProfile.authType` is
5
+ * `'ad-session'` (the app behind the firewall), supplied by the consumer of this library.
6
+ * Required in that case, ignored otherwise.
7
+ */
8
+ export declare function getSessionHandler(testProfile: TestProfile, adTargetUrl?: string): import("nl-portal-playwright-libraries").SessionHandler;
@@ -1,5 +1,12 @@
1
1
  import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
3
  export interface LoginHandler {
4
+ /**
5
+ * Log in and persist the resulting session to a storage state file.
6
+ *
7
+ * @param page the Playwright page to perform the login on
8
+ * @param account login details, supplied by the consumer of this library
9
+ * @param file path of the storage state file to write the session to
10
+ */
4
11
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
5
12
  }
@@ -2,5 +2,16 @@ import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
3
  import { LoginHandler } from '../loginHandler';
4
4
  export declare class ADLoginHandler implements LoginHandler {
5
+ private readonly targetUrl;
6
+ /**
7
+ * @param targetUrl URL to navigate to before logging in (the app behind the firewall),
8
+ * supplied by the consumer of this library
9
+ */
10
+ constructor(targetUrl: string);
11
+ /**
12
+ * @param page the Playwright page to perform the login on
13
+ * @param account login details, supplied by the consumer of this library
14
+ * @param file path of the storage state file to write the session to
15
+ */
5
16
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
17
  }
@@ -2,5 +2,10 @@ import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
3
  import { LoginHandler } from '../loginHandler';
4
4
  export declare class DigidGemachtigdeLoginHandler implements LoginHandler {
5
+ /**
6
+ * @param page the Playwright page to perform the login on
7
+ * @param account login details, supplied by the consumer of this library
8
+ * @param file path of the storage state file to write the session to
9
+ */
5
10
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
11
  }
@@ -2,5 +2,10 @@ import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
3
  import { LoginHandler } from '../loginHandler';
4
4
  export declare class DigidLoginHandler implements LoginHandler {
5
+ /**
6
+ * @param page the Playwright page to perform the login on
7
+ * @param account login details, supplied by the consumer of this library
8
+ * @param file path of the storage state file to write the session to
9
+ */
5
10
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
11
  }
@@ -2,5 +2,10 @@ import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
3
  import { LoginHandler } from '../loginHandler';
4
4
  export declare class EHerkenningBewindvoerderLoginHandler implements LoginHandler {
5
+ /**
6
+ * @param page the Playwright page to perform the login on
7
+ * @param account login details, supplied by the consumer of this library
8
+ * @param file path of the storage state file to write the session to
9
+ */
5
10
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
11
  }
@@ -2,5 +2,10 @@ import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
3
  import { LoginHandler } from '../loginHandler';
4
4
  export declare class EHerkenningLoginHandler implements LoginHandler {
5
+ /**
6
+ * @param page the Playwright page to perform the login on
7
+ * @param account login details, supplied by the consumer of this library
8
+ * @param file path of the storage state file to write the session to
9
+ */
5
10
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
11
  }
@@ -2,5 +2,10 @@ import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
3
  import { LoginHandler } from '../loginHandler';
4
4
  export declare class LocalhostLoginHandler implements LoginHandler {
5
+ /**
6
+ * @param page the Playwright page to perform the login on
7
+ * @param account login details, supplied by the consumer of this library
8
+ * @param file path of the storage state file to write the session to
9
+ */
5
10
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
11
  }
@@ -14,10 +14,37 @@ export declare class ADLoginPage extends BasePage {
14
14
  /**
15
15
  * Login with the AD account so we can get behind the firewall
16
16
  *
17
- * @param account
18
- * @param fileName
17
+ * @param account login details, supplied by the consumer of this library
18
+ * @param targetUrl URL to navigate to before logging in (the app behind the firewall),
19
+ * supplied by the consumer of this library — not every consumer has a GZAC account, so
20
+ * this library no longer assumes GZAC as the destination. The consumer is responsible
21
+ * for switching between environments (e.g. test/acc/prod) when building this URL; this
22
+ * library does not do that for you.
23
+ * @param fileName path of the storage state file to write the session to
24
+ *
25
+ * @example
26
+ * // consumer-side lookup, e.g. based on an `ENV` environment variable
27
+ * export const TARGET_URL_BY_ENVIRONMENT = {
28
+ * test: 'https://alg-zgw.test.denhaag.nl/',
29
+ * acc: 'https://alg-zgw.acc.denhaag.nl/',
30
+ * prod: 'https://alg-zgw.denhaag.nl/',
31
+ * } as const;
32
+ *
33
+ * const env = (process.env.ENV ?? 'test') as keyof typeof TARGET_URL_BY_ENVIRONMENT;
34
+ * await adLoginPage.loginWithADAccountAndCreateSession(account, TARGET_URL_BY_ENVIRONMENT[env], fileName);
19
35
  */
20
- loginWithADAccountAndCreateSession(account: Account, fileName: string): Promise<void>;
36
+ loginWithADAccountAndCreateSession(account: Account, targetUrl: string, fileName: string): Promise<void>;
21
37
  tryAgainUntilSuccesful(): Promise<void>;
38
+ /**
39
+ * Determines the GZAC URL to log in against, based on the current environment.
40
+ *
41
+ * @deprecated GZAC-specific and no longer called internally by this library — pass your own
42
+ * target URL to {@link loginWithADAccountAndCreateSession} instead. Kept only so existing
43
+ * GZAC consumers can still derive this URL themselves during migration; will be removed in
44
+ * a future version.
45
+ *
46
+ * Derives the environment from `this.getBaseUrl()` (inherited from `BasePage`), which reads
47
+ * the `PORTAL_BASE_URL` environment variable.
48
+ */
22
49
  getGzacUrl(): string;
23
50
  }
@@ -3,13 +3,25 @@ import { LoginOverzichtPage } from './loginOverzichtPage';
3
3
  import { Account } from 'nl-portal-playwright-libraries';
4
4
  export declare class DigidLoginPage extends LoginOverzichtPage {
5
5
  constructor(page: Page);
6
+ /**
7
+ * @param account login details, supplied by the consumer of this library
8
+ * @param fileName path of the storage state file to write the session to
9
+ */
6
10
  loginAndCreateNewSession(account: Account, fileName: string): Promise<void>;
11
+ /**
12
+ * @param account login details, supplied by the consumer of this library
13
+ * @param fileName path of the storage state file to write the session to
14
+ */
7
15
  loginAndCreateNewGemachtigdeSession(account: Account, fileName: string): Promise<void>;
8
16
  /**
9
17
  * Indien er al een AD sessie is maar voor de verkeerde omgeving
10
18
  * Je krijgt dan een speciaal scherm waar je moet bevestigen voordat je door kan
11
19
  */
12
20
  handleAnySpecialADLoginScreen(): Promise<void>;
21
+ /**
22
+ * @param account login details, supplied by the consumer of this library
23
+ * @param gemachtigde whether to log in as an authorized representative (machtiging) instead of a regular user
24
+ */
13
25
  loginWithDigid(account: Account, gemachtigde?: boolean): Promise<import("@playwright/test").Response>;
14
26
  loginAlsDigidGemachtigde(): Promise<void>;
15
27
  }
@@ -12,10 +12,31 @@ export declare class EHerkenningLoginPage extends LoginOverzichtPage {
12
12
  private readonly inputBsn;
13
13
  private readonly buttonZoek;
14
14
  constructor(page: Page);
15
+ /**
16
+ * @param account login details, supplied by the consumer of this library
17
+ */
15
18
  probeerInTeLoggenMetEHerkenning(account: Account): Promise<void>;
19
+ /**
20
+ * @param fileName path of the storage state file to write the session to
21
+ * @param account login details, supplied by the consumer of this library
22
+ */
16
23
  loginWithEHerkenningAndCreateSession(fileName: string, account: Account): Promise<void>;
24
+ /**
25
+ * @param account login details, supplied by the consumer of this library
26
+ */
17
27
  loginWithEHerkenning(account: Account): Promise<void>;
28
+ /**
29
+ * @param fileName path of the storage state file to write the session to
30
+ * @param account login details, supplied by the consumer of this library
31
+ */
18
32
  loginWithEHerkenningVestigingAndCreateSession(fileName: string, account: Account): Promise<void>;
33
+ /**
34
+ * @param account login details, supplied by the consumer of this library
35
+ */
19
36
  loginWithEHerkenningVestiging(account: Account): Promise<void>;
37
+ /**
38
+ * @param gemachtigde login details of the authorized representative (bewindvoerder), supplied by the consumer of this library
39
+ * @param file optional path of the storage state file to write the session to
40
+ */
20
41
  loginAlsProfessioneelBewindvoerder(gemachtigde: Account, file?: string): Promise<void>;
21
42
  }
@@ -7,7 +7,7 @@ export declare const MAX_SESSION_TIME_IN_MINUTES = 10;
7
7
  * It will also perform the process of setting op the session
8
8
  *
9
9
  * @param authType type of login
10
- * @param account with login details
10
+ * @param account login details, supplied by the consumer of this library
11
11
  * @param loginHandler that will handle the login itself
12
12
  */
13
13
  export declare function createSessionHandler(authType: AuthType, account: Account, loginHandler: LoginHandler): SessionHandler;
@@ -4,12 +4,44 @@ import { Account } from 'nl-portal-playwright-libraries';
4
4
  * Easy way to create the filenames for the sessions
5
5
  */
6
6
  export declare class SessionFileHelper {
7
+ /**
8
+ * @param browser the browser instance the session file name is based on
9
+ * @param account login details, supplied by the consumer of this library; only `username` is used
10
+ */
7
11
  static getLocalhostFileName(browser: Browser, account: Account): string;
12
+ /**
13
+ * @param browser the browser instance the session file name is based on
14
+ * @param account login details, supplied by the consumer of this library; only `username` is used
15
+ */
8
16
  static getLocalhostFileNameBedrijf(browser: Browser, account: Account): string;
17
+ /**
18
+ * @param browser the browser instance the session file name is based on
19
+ * @param account login details, supplied by the consumer of this library; only `username` is used
20
+ */
9
21
  static getDigidFileName(browser: Browser, account: Account): string;
22
+ /**
23
+ * @param browser the browser instance the session file name is based on
24
+ * @param account login details, supplied by the consumer of this library; only `username` is used
25
+ */
10
26
  static getDigidGemachtigdeFileName(browser: Browser, account: Account): string;
27
+ /**
28
+ * @param browser the browser instance the session file name is based on
29
+ * @param account login details, supplied by the consumer of this library; only `username` is used
30
+ */
11
31
  static getEHerkenningFileName(browser: Browser, account: Account): string;
32
+ /**
33
+ * @param browser the browser instance the session file name is based on
34
+ * @param account login details, supplied by the consumer of this library; only `username` is used
35
+ */
12
36
  static getEHerkenningVestigingFileName(browser: Browser, account: Account): string;
37
+ /**
38
+ * @param browser the browser instance the session file name is based on
39
+ * @param account login details, supplied by the consumer of this library; only `username` is used
40
+ */
13
41
  static getEHerkenningBewindvoerderFileName(browser: Browser, account: Account): string;
42
+ /**
43
+ * @param browser the browser instance the session file name is based on
44
+ * @param account login details, supplied by the consumer of this library; only `username` is used
45
+ */
14
46
  static getADFileName(browser: Browser, account: Account): string;
15
47
  }
package/dist/index.cjs.js CHANGED
@@ -30,6 +30,11 @@ let node_path = require("node:path");
30
30
  node_path = __toESM(node_path);
31
31
  //#region src/auth/loginhandlers/localhostLoginHandler.ts
32
32
  var LocalhostLoginHandler = class {
33
+ /**
34
+ * @param page the Playwright page to perform the login on
35
+ * @param account login details, supplied by the consumer of this library
36
+ * @param file path of the storage state file to write the session to
37
+ */
33
38
  async loginAndCreateSessionStorage(page, account, file) {
34
39
  await new nl_portal_playwright_libraries.LocalLoginPage(page).loginAndCreateNewSession(account, file);
35
40
  }
@@ -102,6 +107,10 @@ var DigidLoginPage = class extends LoginOverzichtPage {
102
107
  constructor(page) {
103
108
  super(page);
104
109
  }
110
+ /**
111
+ * @param account login details, supplied by the consumer of this library
112
+ * @param fileName path of the storage state file to write the session to
113
+ */
105
114
  async loginAndCreateNewSession(account, fileName) {
106
115
  await this.openPage();
107
116
  await this.handleAnySpecialADLoginScreen();
@@ -118,6 +127,10 @@ var DigidLoginPage = class extends LoginOverzichtPage {
118
127
  }
119
128
  await this.page.context().storageState({ path: fileName });
120
129
  }
130
+ /**
131
+ * @param account login details, supplied by the consumer of this library
132
+ * @param fileName path of the storage state file to write the session to
133
+ */
121
134
  async loginAndCreateNewGemachtigdeSession(account, fileName) {
122
135
  await this.openPage();
123
136
  await this.handleAnySpecialADLoginScreen();
@@ -141,6 +154,10 @@ var DigidLoginPage = class extends LoginOverzichtPage {
141
154
  await this.page.locator(`//div[contains(@data-test-id,'${node_process.default.env.AD_USER}')]`).first().click();
142
155
  } catch (_error) {}
143
156
  }
157
+ /**
158
+ * @param account login details, supplied by the consumer of this library
159
+ * @param gemachtigde whether to log in as an authorized representative (machtiging) instead of a regular user
160
+ */
144
161
  async loginWithDigid(account, gemachtigde) {
145
162
  await this.page.getByLabel("Inlogoptie 5 van 5: Inloggen").click();
146
163
  await this.page.getByLabel("Testen betrouwbaarheidsniveau").selectOption("25");
@@ -163,6 +180,11 @@ var DigidLoginPage = class extends LoginOverzichtPage {
163
180
  //#endregion
164
181
  //#region src/auth/loginhandlers/digidLoginHandler.ts
165
182
  var DigidLoginHandler = class {
183
+ /**
184
+ * @param page the Playwright page to perform the login on
185
+ * @param account login details, supplied by the consumer of this library
186
+ * @param file path of the storage state file to write the session to
187
+ */
166
188
  async loginAndCreateSessionStorage(page, account, file) {
167
189
  await new DigidLoginPage(page).loginAndCreateNewSession(account, file);
168
190
  }
@@ -191,6 +213,9 @@ var EHerkenningLoginPage = class extends LoginOverzichtPage {
191
213
  this.buttonZoek = page.locator("#search-submit");
192
214
  this.verderLink = page.getByRole("link", { name: /Verder|Continue|Ga verder/ });
193
215
  }
216
+ /**
217
+ * @param account login details, supplied by the consumer of this library
218
+ */
194
219
  async probeerInTeLoggenMetEHerkenning(account) {
195
220
  await this.dropdownSelectIdentityProvider.selectOption("Digidentity AD 1.13 (preproduction)");
196
221
  await this.page.locator("#remember").click();
@@ -200,6 +225,10 @@ var EHerkenningLoginPage = class extends LoginOverzichtPage {
200
225
  await this.textfieldPassword.fill(account.password);
201
226
  await this.inloggenKnop.click();
202
227
  }
228
+ /**
229
+ * @param fileName path of the storage state file to write the session to
230
+ * @param account login details, supplied by the consumer of this library
231
+ */
203
232
  async loginWithEHerkenningAndCreateSession(fileName, account) {
204
233
  await this.openPage();
205
234
  try {
@@ -211,12 +240,19 @@ var EHerkenningLoginPage = class extends LoginOverzichtPage {
211
240
  await this.loginWithEHerkenning(account);
212
241
  await this.page.context().storageState({ path: fileName });
213
242
  }
243
+ /**
244
+ * @param account login details, supplied by the consumer of this library
245
+ */
214
246
  async loginWithEHerkenning(account) {
215
247
  await this.probeerInTeLoggenMetEHerkenning(account);
216
248
  await this.page.waitForTimeout(2e3);
217
249
  if (await this.verderKnop.isVisible()) await this.verderKnop.click();
218
250
  await this.accepteerCookies();
219
251
  }
252
+ /**
253
+ * @param fileName path of the storage state file to write the session to
254
+ * @param account login details, supplied by the consumer of this library
255
+ */
220
256
  async loginWithEHerkenningVestigingAndCreateSession(fileName, account) {
221
257
  await this.openPage();
222
258
  try {
@@ -228,12 +264,19 @@ var EHerkenningLoginPage = class extends LoginOverzichtPage {
228
264
  await this.loginWithEHerkenningVestiging(account);
229
265
  await this.page.context().storageState({ path: fileName });
230
266
  }
267
+ /**
268
+ * @param account login details, supplied by the consumer of this library
269
+ */
231
270
  async loginWithEHerkenningVestiging(account) {
232
271
  await this.probeerInTeLoggenMetEHerkenning(account);
233
272
  await this.page.waitForTimeout(2e3);
234
273
  if (await this.verderKnop.isVisible()) await this.verderKnop.click();
235
274
  await this.accepteerCookies();
236
275
  }
276
+ /**
277
+ * @param gemachtigde login details of the authorized representative (bewindvoerder), supplied by the consumer of this library
278
+ * @param file optional path of the storage state file to write the session to
279
+ */
237
280
  async loginAlsProfessioneelBewindvoerder(gemachtigde, file) {
238
281
  await this.openPage();
239
282
  await this.klikOpProfessioneelBewindvoerderLoginOptie();
@@ -256,6 +299,11 @@ var EHerkenningLoginPage = class extends LoginOverzichtPage {
256
299
  //#endregion
257
300
  //#region src/auth/loginhandlers/eHerkenningLoginHandler.ts
258
301
  var EHerkenningLoginHandler = class {
302
+ /**
303
+ * @param page the Playwright page to perform the login on
304
+ * @param account login details, supplied by the consumer of this library
305
+ * @param file path of the storage state file to write the session to
306
+ */
259
307
  async loginAndCreateSessionStorage(page, account, file) {
260
308
  await new EHerkenningLoginPage(page).loginWithEHerkenningVestigingAndCreateSession(file, account);
261
309
  }
@@ -263,6 +311,11 @@ var EHerkenningLoginHandler = class {
263
311
  //#endregion
264
312
  //#region src/auth/loginhandlers/digidGemachtigdeLoginHandler.ts
265
313
  var DigidGemachtigdeLoginHandler = class {
314
+ /**
315
+ * @param page the Playwright page to perform the login on
316
+ * @param account login details, supplied by the consumer of this library
317
+ * @param file path of the storage state file to write the session to
318
+ */
266
319
  async loginAndCreateSessionStorage(page, account, file) {
267
320
  await new DigidLoginPage(page).loginAndCreateNewGemachtigdeSession(account, file);
268
321
  }
@@ -270,6 +323,11 @@ var DigidGemachtigdeLoginHandler = class {
270
323
  //#endregion
271
324
  //#region src/auth/loginhandlers/eHerkenningBewindvoerderLoginHandler.ts
272
325
  var EHerkenningBewindvoerderLoginHandler = class {
326
+ /**
327
+ * @param page the Playwright page to perform the login on
328
+ * @param account login details, supplied by the consumer of this library
329
+ * @param file path of the storage state file to write the session to
330
+ */
273
331
  async loginAndCreateSessionStorage(page, account, file) {
274
332
  await new EHerkenningLoginPage(page).loginAlsProfessioneelBewindvoerder(account, file);
275
333
  }
@@ -305,15 +363,32 @@ var ADLoginPage = class ADLoginPage extends nl_portal_playwright_libraries.BaseP
305
363
  /**
306
364
  * Login with the AD account so we can get behind the firewall
307
365
  *
308
- * @param account
309
- * @param fileName
366
+ * @param account login details, supplied by the consumer of this library
367
+ * @param targetUrl URL to navigate to before logging in (the app behind the firewall),
368
+ * supplied by the consumer of this library — not every consumer has a GZAC account, so
369
+ * this library no longer assumes GZAC as the destination. The consumer is responsible
370
+ * for switching between environments (e.g. test/acc/prod) when building this URL; this
371
+ * library does not do that for you.
372
+ * @param fileName path of the storage state file to write the session to
373
+ *
374
+ * @example
375
+ * // consumer-side lookup, e.g. based on an `ENV` environment variable
376
+ * export const TARGET_URL_BY_ENVIRONMENT = {
377
+ * test: 'https://alg-zgw.test.denhaag.nl/',
378
+ * acc: 'https://alg-zgw.acc.denhaag.nl/',
379
+ * prod: 'https://alg-zgw.denhaag.nl/',
380
+ * } as const;
381
+ *
382
+ * const env = (process.env.ENV ?? 'test') as keyof typeof TARGET_URL_BY_ENVIRONMENT;
383
+ * await adLoginPage.loginWithADAccountAndCreateSession(account, TARGET_URL_BY_ENVIRONMENT[env], fileName);
310
384
  */
311
- async loginWithADAccountAndCreateSession(account, fileName) {
385
+ async loginWithADAccountAndCreateSession(account, targetUrl, fileName) {
312
386
  const adLoginPage = new ADLoginPage(this.page);
313
- await this.page.goto(this.getGzacUrl());
387
+ await this.page.goto(targetUrl);
314
388
  await adLoginPage.gebruikersnaamInput.waitFor();
315
389
  await adLoginPage.gebruikersnaamInput.fill(account.username);
316
390
  await adLoginPage.volgendeInput.click();
391
+ await this.page.getByText("Uw wachtwoord gebruiken").click();
317
392
  await adLoginPage.wachtwoordInput.fill(account.password);
318
393
  await adLoginPage.aanmeldenInput.click();
319
394
  await this.page.waitForTimeout(1e3);
@@ -345,6 +420,17 @@ var ADLoginPage = class ADLoginPage extends nl_portal_playwright_libraries.BaseP
345
420
  } catch (_error) {}
346
421
  }
347
422
  }
423
+ /**
424
+ * Determines the GZAC URL to log in against, based on the current environment.
425
+ *
426
+ * @deprecated GZAC-specific and no longer called internally by this library — pass your own
427
+ * target URL to {@link loginWithADAccountAndCreateSession} instead. Kept only so existing
428
+ * GZAC consumers can still derive this URL themselves during migration; will be removed in
429
+ * a future version.
430
+ *
431
+ * Derives the environment from `this.getBaseUrl()` (inherited from `BasePage`), which reads
432
+ * the `PORTAL_BASE_URL` environment variable.
433
+ */
348
434
  getGzacUrl() {
349
435
  const baseUrl = this.getBaseUrl();
350
436
  if (/klantportaal-zgw.denhaag.nl./.exec(baseUrl)) return gzacUrlProd;
@@ -356,20 +442,41 @@ var ADLoginPage = class ADLoginPage extends nl_portal_playwright_libraries.BaseP
356
442
  //#endregion
357
443
  //#region src/auth/loginhandlers/adLoginHandler.ts
358
444
  var ADLoginHandler = class {
445
+ targetUrl;
446
+ /**
447
+ * @param targetUrl URL to navigate to before logging in (the app behind the firewall),
448
+ * supplied by the consumer of this library
449
+ */
450
+ constructor(targetUrl) {
451
+ this.targetUrl = targetUrl;
452
+ }
453
+ /**
454
+ * @param page the Playwright page to perform the login on
455
+ * @param account login details, supplied by the consumer of this library
456
+ * @param file path of the storage state file to write the session to
457
+ */
359
458
  async loginAndCreateSessionStorage(page, account, file) {
360
- await new ADLoginPage(page).loginWithADAccountAndCreateSession(account, file);
459
+ await new ADLoginPage(page).loginWithADAccountAndCreateSession(account, this.targetUrl, file);
361
460
  }
362
461
  };
363
462
  //#endregion
364
463
  //#region src/auth/getLoginHandler.ts
365
- function getLoginHandler(authType) {
464
+ /**
465
+ * @param authType type of login
466
+ * @param adTargetUrl URL to navigate to before logging in for the `ad-session` auth type (the
467
+ * app behind the firewall), supplied by the consumer of this library. Required when
468
+ * `authType` is `'ad-session'`, ignored otherwise.
469
+ */
470
+ function getLoginHandler(authType, adTargetUrl) {
366
471
  switch (authType) {
367
472
  case "digid": return (0, nl_portal_playwright_libraries.isRunningOnLocalhost)() ? new LocalhostLoginHandler() : new DigidLoginHandler();
368
473
  case "digid_gemachtigde": return new DigidGemachtigdeLoginHandler();
369
474
  case "eherkenning": return (0, nl_portal_playwright_libraries.isRunningOnLocalhost)() ? new LocalhostLoginHandler() : new EHerkenningLoginHandler();
370
475
  case "eherkenning_vestiging": return new EHerkenningLoginHandler();
371
476
  case "eherkenning_bewindvoerder": return new EHerkenningBewindvoerderLoginHandler();
372
- case "ad-session": return new ADLoginHandler();
477
+ case "ad-session":
478
+ if (!adTargetUrl) throw new Error("adTargetUrl is required when authType is 'ad-session'");
479
+ return new ADLoginHandler(adTargetUrl);
373
480
  default: throw new Error(`Unsupported auth type: ${authType}. If needed please create a new LoginHandler and register it here in getLoginHandler().`);
374
481
  }
375
482
  }
@@ -381,27 +488,59 @@ var environment = node_process.env.ENV ?? "test";
381
488
  * Easy way to create the filenames for the sessions
382
489
  */
383
490
  var SessionFileHelper = class {
491
+ /**
492
+ * @param browser the browser instance the session file name is based on
493
+ * @param account login details, supplied by the consumer of this library; only `username` is used
494
+ */
384
495
  static getLocalhostFileName(browser, account) {
385
496
  return node_path.join(sessionsDir, `${browser.browserType().name()}-${environment}-${account.username}.json`);
386
497
  }
498
+ /**
499
+ * @param browser the browser instance the session file name is based on
500
+ * @param account login details, supplied by the consumer of this library; only `username` is used
501
+ */
387
502
  static getLocalhostFileNameBedrijf(browser, account) {
388
503
  return node_path.join(sessionsDir, `${browser.browserType().name()}-${environment}-${account.username}.json`);
389
504
  }
505
+ /**
506
+ * @param browser the browser instance the session file name is based on
507
+ * @param account login details, supplied by the consumer of this library; only `username` is used
508
+ */
390
509
  static getDigidFileName(browser, account) {
391
510
  return node_path.join(sessionsDir, `${browser.browserType().name()}-digid-${environment}-${account.username}.json`);
392
511
  }
512
+ /**
513
+ * @param browser the browser instance the session file name is based on
514
+ * @param account login details, supplied by the consumer of this library; only `username` is used
515
+ */
393
516
  static getDigidGemachtigdeFileName(browser, account) {
394
517
  return node_path.join(sessionsDir, `${browser.browserType().name()}-digid-gemachtigde-${environment}-${account.username}.json`);
395
518
  }
519
+ /**
520
+ * @param browser the browser instance the session file name is based on
521
+ * @param account login details, supplied by the consumer of this library; only `username` is used
522
+ */
396
523
  static getEHerkenningFileName(browser, account) {
397
524
  return node_path.join(sessionsDir, `${browser.browserType().name()}-eherkenning-${environment}-${account.username}.json`);
398
525
  }
526
+ /**
527
+ * @param browser the browser instance the session file name is based on
528
+ * @param account login details, supplied by the consumer of this library; only `username` is used
529
+ */
399
530
  static getEHerkenningVestigingFileName(browser, account) {
400
531
  return node_path.join(sessionsDir, `${browser.browserType().name()}-eherkenning-vestiging-${environment}-${account.username}.json`);
401
532
  }
533
+ /**
534
+ * @param browser the browser instance the session file name is based on
535
+ * @param account login details, supplied by the consumer of this library; only `username` is used
536
+ */
402
537
  static getEHerkenningBewindvoerderFileName(browser, account) {
403
538
  return node_path.join(sessionsDir, `${browser.browserType().name()}-eherkenning-bewindvoerder-${environment}-${account.username}.json`);
404
539
  }
540
+ /**
541
+ * @param browser the browser instance the session file name is based on
542
+ * @param account login details, supplied by the consumer of this library; only `username` is used
543
+ */
405
544
  static getADFileName(browser, account) {
406
545
  return node_path.join(sessionsDir, `${browser.browserType().name()}-ad-${environment}-${account.username}.json`);
407
546
  }
@@ -414,7 +553,7 @@ var MAX_SESSION_TIME_IN_MINUTES = 10;
414
553
  * It will also perform the process of setting op the session
415
554
  *
416
555
  * @param authType type of login
417
- * @param account with login details
556
+ * @param account login details, supplied by the consumer of this library
418
557
  * @param loginHandler that will handle the login itself
419
558
  */
420
559
  function createSessionHandler(authType, account, loginHandler) {
@@ -540,8 +679,14 @@ function getApiTokenFromSession(baseTest, handler) {
540
679
  }
541
680
  //#endregion
542
681
  //#region src/auth/getSessionHandler.ts
543
- function getSessionHandler(testProfile) {
544
- return createSessionHandler(testProfile.authType, testProfile.account, getLoginHandler(testProfile.authType));
682
+ /**
683
+ * @param testProfile
684
+ * @param adTargetUrl URL to navigate to before logging in when `testProfile.authType` is
685
+ * `'ad-session'` (the app behind the firewall), supplied by the consumer of this library.
686
+ * Required in that case, ignored otherwise.
687
+ */
688
+ function getSessionHandler(testProfile, adTargetUrl) {
689
+ return createSessionHandler(testProfile.authType, testProfile.account, getLoginHandler(testProfile.authType, adTargetUrl));
545
690
  }
546
691
  //#endregion
547
692
  exports.ADLoginHandler = ADLoginHandler;
package/dist/index.es.js CHANGED
@@ -6,6 +6,11 @@ import { TOTP } from "totp-generator";
6
6
  import * as path from "node:path";
7
7
  //#region src/auth/loginhandlers/localhostLoginHandler.ts
8
8
  var LocalhostLoginHandler = class {
9
+ /**
10
+ * @param page the Playwright page to perform the login on
11
+ * @param account login details, supplied by the consumer of this library
12
+ * @param file path of the storage state file to write the session to
13
+ */
9
14
  async loginAndCreateSessionStorage(page, account, file) {
10
15
  await new LocalLoginPage(page).loginAndCreateNewSession(account, file);
11
16
  }
@@ -78,6 +83,10 @@ var DigidLoginPage = class extends LoginOverzichtPage {
78
83
  constructor(page) {
79
84
  super(page);
80
85
  }
86
+ /**
87
+ * @param account login details, supplied by the consumer of this library
88
+ * @param fileName path of the storage state file to write the session to
89
+ */
81
90
  async loginAndCreateNewSession(account, fileName) {
82
91
  await this.openPage();
83
92
  await this.handleAnySpecialADLoginScreen();
@@ -94,6 +103,10 @@ var DigidLoginPage = class extends LoginOverzichtPage {
94
103
  }
95
104
  await this.page.context().storageState({ path: fileName });
96
105
  }
106
+ /**
107
+ * @param account login details, supplied by the consumer of this library
108
+ * @param fileName path of the storage state file to write the session to
109
+ */
97
110
  async loginAndCreateNewGemachtigdeSession(account, fileName) {
98
111
  await this.openPage();
99
112
  await this.handleAnySpecialADLoginScreen();
@@ -117,6 +130,10 @@ var DigidLoginPage = class extends LoginOverzichtPage {
117
130
  await this.page.locator(`//div[contains(@data-test-id,'${process$1.env.AD_USER}')]`).first().click();
118
131
  } catch (_error) {}
119
132
  }
133
+ /**
134
+ * @param account login details, supplied by the consumer of this library
135
+ * @param gemachtigde whether to log in as an authorized representative (machtiging) instead of a regular user
136
+ */
120
137
  async loginWithDigid(account, gemachtigde) {
121
138
  await this.page.getByLabel("Inlogoptie 5 van 5: Inloggen").click();
122
139
  await this.page.getByLabel("Testen betrouwbaarheidsniveau").selectOption("25");
@@ -139,6 +156,11 @@ var DigidLoginPage = class extends LoginOverzichtPage {
139
156
  //#endregion
140
157
  //#region src/auth/loginhandlers/digidLoginHandler.ts
141
158
  var DigidLoginHandler = class {
159
+ /**
160
+ * @param page the Playwright page to perform the login on
161
+ * @param account login details, supplied by the consumer of this library
162
+ * @param file path of the storage state file to write the session to
163
+ */
142
164
  async loginAndCreateSessionStorage(page, account, file) {
143
165
  await new DigidLoginPage(page).loginAndCreateNewSession(account, file);
144
166
  }
@@ -167,6 +189,9 @@ var EHerkenningLoginPage = class extends LoginOverzichtPage {
167
189
  this.buttonZoek = page.locator("#search-submit");
168
190
  this.verderLink = page.getByRole("link", { name: /Verder|Continue|Ga verder/ });
169
191
  }
192
+ /**
193
+ * @param account login details, supplied by the consumer of this library
194
+ */
170
195
  async probeerInTeLoggenMetEHerkenning(account) {
171
196
  await this.dropdownSelectIdentityProvider.selectOption("Digidentity AD 1.13 (preproduction)");
172
197
  await this.page.locator("#remember").click();
@@ -176,6 +201,10 @@ var EHerkenningLoginPage = class extends LoginOverzichtPage {
176
201
  await this.textfieldPassword.fill(account.password);
177
202
  await this.inloggenKnop.click();
178
203
  }
204
+ /**
205
+ * @param fileName path of the storage state file to write the session to
206
+ * @param account login details, supplied by the consumer of this library
207
+ */
179
208
  async loginWithEHerkenningAndCreateSession(fileName, account) {
180
209
  await this.openPage();
181
210
  try {
@@ -187,12 +216,19 @@ var EHerkenningLoginPage = class extends LoginOverzichtPage {
187
216
  await this.loginWithEHerkenning(account);
188
217
  await this.page.context().storageState({ path: fileName });
189
218
  }
219
+ /**
220
+ * @param account login details, supplied by the consumer of this library
221
+ */
190
222
  async loginWithEHerkenning(account) {
191
223
  await this.probeerInTeLoggenMetEHerkenning(account);
192
224
  await this.page.waitForTimeout(2e3);
193
225
  if (await this.verderKnop.isVisible()) await this.verderKnop.click();
194
226
  await this.accepteerCookies();
195
227
  }
228
+ /**
229
+ * @param fileName path of the storage state file to write the session to
230
+ * @param account login details, supplied by the consumer of this library
231
+ */
196
232
  async loginWithEHerkenningVestigingAndCreateSession(fileName, account) {
197
233
  await this.openPage();
198
234
  try {
@@ -204,12 +240,19 @@ var EHerkenningLoginPage = class extends LoginOverzichtPage {
204
240
  await this.loginWithEHerkenningVestiging(account);
205
241
  await this.page.context().storageState({ path: fileName });
206
242
  }
243
+ /**
244
+ * @param account login details, supplied by the consumer of this library
245
+ */
207
246
  async loginWithEHerkenningVestiging(account) {
208
247
  await this.probeerInTeLoggenMetEHerkenning(account);
209
248
  await this.page.waitForTimeout(2e3);
210
249
  if (await this.verderKnop.isVisible()) await this.verderKnop.click();
211
250
  await this.accepteerCookies();
212
251
  }
252
+ /**
253
+ * @param gemachtigde login details of the authorized representative (bewindvoerder), supplied by the consumer of this library
254
+ * @param file optional path of the storage state file to write the session to
255
+ */
213
256
  async loginAlsProfessioneelBewindvoerder(gemachtigde, file) {
214
257
  await this.openPage();
215
258
  await this.klikOpProfessioneelBewindvoerderLoginOptie();
@@ -232,6 +275,11 @@ var EHerkenningLoginPage = class extends LoginOverzichtPage {
232
275
  //#endregion
233
276
  //#region src/auth/loginhandlers/eHerkenningLoginHandler.ts
234
277
  var EHerkenningLoginHandler = class {
278
+ /**
279
+ * @param page the Playwright page to perform the login on
280
+ * @param account login details, supplied by the consumer of this library
281
+ * @param file path of the storage state file to write the session to
282
+ */
235
283
  async loginAndCreateSessionStorage(page, account, file) {
236
284
  await new EHerkenningLoginPage(page).loginWithEHerkenningVestigingAndCreateSession(file, account);
237
285
  }
@@ -239,6 +287,11 @@ var EHerkenningLoginHandler = class {
239
287
  //#endregion
240
288
  //#region src/auth/loginhandlers/digidGemachtigdeLoginHandler.ts
241
289
  var DigidGemachtigdeLoginHandler = class {
290
+ /**
291
+ * @param page the Playwright page to perform the login on
292
+ * @param account login details, supplied by the consumer of this library
293
+ * @param file path of the storage state file to write the session to
294
+ */
242
295
  async loginAndCreateSessionStorage(page, account, file) {
243
296
  await new DigidLoginPage(page).loginAndCreateNewGemachtigdeSession(account, file);
244
297
  }
@@ -246,6 +299,11 @@ var DigidGemachtigdeLoginHandler = class {
246
299
  //#endregion
247
300
  //#region src/auth/loginhandlers/eHerkenningBewindvoerderLoginHandler.ts
248
301
  var EHerkenningBewindvoerderLoginHandler = class {
302
+ /**
303
+ * @param page the Playwright page to perform the login on
304
+ * @param account login details, supplied by the consumer of this library
305
+ * @param file path of the storage state file to write the session to
306
+ */
249
307
  async loginAndCreateSessionStorage(page, account, file) {
250
308
  await new EHerkenningLoginPage(page).loginAlsProfessioneelBewindvoerder(account, file);
251
309
  }
@@ -281,15 +339,32 @@ var ADLoginPage = class ADLoginPage extends BasePage {
281
339
  /**
282
340
  * Login with the AD account so we can get behind the firewall
283
341
  *
284
- * @param account
285
- * @param fileName
342
+ * @param account login details, supplied by the consumer of this library
343
+ * @param targetUrl URL to navigate to before logging in (the app behind the firewall),
344
+ * supplied by the consumer of this library — not every consumer has a GZAC account, so
345
+ * this library no longer assumes GZAC as the destination. The consumer is responsible
346
+ * for switching between environments (e.g. test/acc/prod) when building this URL; this
347
+ * library does not do that for you.
348
+ * @param fileName path of the storage state file to write the session to
349
+ *
350
+ * @example
351
+ * // consumer-side lookup, e.g. based on an `ENV` environment variable
352
+ * export const TARGET_URL_BY_ENVIRONMENT = {
353
+ * test: 'https://alg-zgw.test.denhaag.nl/',
354
+ * acc: 'https://alg-zgw.acc.denhaag.nl/',
355
+ * prod: 'https://alg-zgw.denhaag.nl/',
356
+ * } as const;
357
+ *
358
+ * const env = (process.env.ENV ?? 'test') as keyof typeof TARGET_URL_BY_ENVIRONMENT;
359
+ * await adLoginPage.loginWithADAccountAndCreateSession(account, TARGET_URL_BY_ENVIRONMENT[env], fileName);
286
360
  */
287
- async loginWithADAccountAndCreateSession(account, fileName) {
361
+ async loginWithADAccountAndCreateSession(account, targetUrl, fileName) {
288
362
  const adLoginPage = new ADLoginPage(this.page);
289
- await this.page.goto(this.getGzacUrl());
363
+ await this.page.goto(targetUrl);
290
364
  await adLoginPage.gebruikersnaamInput.waitFor();
291
365
  await adLoginPage.gebruikersnaamInput.fill(account.username);
292
366
  await adLoginPage.volgendeInput.click();
367
+ await this.page.getByText("Uw wachtwoord gebruiken").click();
293
368
  await adLoginPage.wachtwoordInput.fill(account.password);
294
369
  await adLoginPage.aanmeldenInput.click();
295
370
  await this.page.waitForTimeout(1e3);
@@ -321,6 +396,17 @@ var ADLoginPage = class ADLoginPage extends BasePage {
321
396
  } catch (_error) {}
322
397
  }
323
398
  }
399
+ /**
400
+ * Determines the GZAC URL to log in against, based on the current environment.
401
+ *
402
+ * @deprecated GZAC-specific and no longer called internally by this library — pass your own
403
+ * target URL to {@link loginWithADAccountAndCreateSession} instead. Kept only so existing
404
+ * GZAC consumers can still derive this URL themselves during migration; will be removed in
405
+ * a future version.
406
+ *
407
+ * Derives the environment from `this.getBaseUrl()` (inherited from `BasePage`), which reads
408
+ * the `PORTAL_BASE_URL` environment variable.
409
+ */
324
410
  getGzacUrl() {
325
411
  const baseUrl = this.getBaseUrl();
326
412
  if (/klantportaal-zgw.denhaag.nl./.exec(baseUrl)) return gzacUrlProd;
@@ -332,20 +418,41 @@ var ADLoginPage = class ADLoginPage extends BasePage {
332
418
  //#endregion
333
419
  //#region src/auth/loginhandlers/adLoginHandler.ts
334
420
  var ADLoginHandler = class {
421
+ targetUrl;
422
+ /**
423
+ * @param targetUrl URL to navigate to before logging in (the app behind the firewall),
424
+ * supplied by the consumer of this library
425
+ */
426
+ constructor(targetUrl) {
427
+ this.targetUrl = targetUrl;
428
+ }
429
+ /**
430
+ * @param page the Playwright page to perform the login on
431
+ * @param account login details, supplied by the consumer of this library
432
+ * @param file path of the storage state file to write the session to
433
+ */
335
434
  async loginAndCreateSessionStorage(page, account, file) {
336
- await new ADLoginPage(page).loginWithADAccountAndCreateSession(account, file);
435
+ await new ADLoginPage(page).loginWithADAccountAndCreateSession(account, this.targetUrl, file);
337
436
  }
338
437
  };
339
438
  //#endregion
340
439
  //#region src/auth/getLoginHandler.ts
341
- function getLoginHandler(authType) {
440
+ /**
441
+ * @param authType type of login
442
+ * @param adTargetUrl URL to navigate to before logging in for the `ad-session` auth type (the
443
+ * app behind the firewall), supplied by the consumer of this library. Required when
444
+ * `authType` is `'ad-session'`, ignored otherwise.
445
+ */
446
+ function getLoginHandler(authType, adTargetUrl) {
342
447
  switch (authType) {
343
448
  case "digid": return isRunningOnLocalhost() ? new LocalhostLoginHandler() : new DigidLoginHandler();
344
449
  case "digid_gemachtigde": return new DigidGemachtigdeLoginHandler();
345
450
  case "eherkenning": return isRunningOnLocalhost() ? new LocalhostLoginHandler() : new EHerkenningLoginHandler();
346
451
  case "eherkenning_vestiging": return new EHerkenningLoginHandler();
347
452
  case "eherkenning_bewindvoerder": return new EHerkenningBewindvoerderLoginHandler();
348
- case "ad-session": return new ADLoginHandler();
453
+ case "ad-session":
454
+ if (!adTargetUrl) throw new Error("adTargetUrl is required when authType is 'ad-session'");
455
+ return new ADLoginHandler(adTargetUrl);
349
456
  default: throw new Error(`Unsupported auth type: ${authType}. If needed please create a new LoginHandler and register it here in getLoginHandler().`);
350
457
  }
351
458
  }
@@ -357,27 +464,59 @@ var environment = process$2.env.ENV ?? "test";
357
464
  * Easy way to create the filenames for the sessions
358
465
  */
359
466
  var SessionFileHelper = class {
467
+ /**
468
+ * @param browser the browser instance the session file name is based on
469
+ * @param account login details, supplied by the consumer of this library; only `username` is used
470
+ */
360
471
  static getLocalhostFileName(browser, account) {
361
472
  return path.join(sessionsDir, `${browser.browserType().name()}-${environment}-${account.username}.json`);
362
473
  }
474
+ /**
475
+ * @param browser the browser instance the session file name is based on
476
+ * @param account login details, supplied by the consumer of this library; only `username` is used
477
+ */
363
478
  static getLocalhostFileNameBedrijf(browser, account) {
364
479
  return path.join(sessionsDir, `${browser.browserType().name()}-${environment}-${account.username}.json`);
365
480
  }
481
+ /**
482
+ * @param browser the browser instance the session file name is based on
483
+ * @param account login details, supplied by the consumer of this library; only `username` is used
484
+ */
366
485
  static getDigidFileName(browser, account) {
367
486
  return path.join(sessionsDir, `${browser.browserType().name()}-digid-${environment}-${account.username}.json`);
368
487
  }
488
+ /**
489
+ * @param browser the browser instance the session file name is based on
490
+ * @param account login details, supplied by the consumer of this library; only `username` is used
491
+ */
369
492
  static getDigidGemachtigdeFileName(browser, account) {
370
493
  return path.join(sessionsDir, `${browser.browserType().name()}-digid-gemachtigde-${environment}-${account.username}.json`);
371
494
  }
495
+ /**
496
+ * @param browser the browser instance the session file name is based on
497
+ * @param account login details, supplied by the consumer of this library; only `username` is used
498
+ */
372
499
  static getEHerkenningFileName(browser, account) {
373
500
  return path.join(sessionsDir, `${browser.browserType().name()}-eherkenning-${environment}-${account.username}.json`);
374
501
  }
502
+ /**
503
+ * @param browser the browser instance the session file name is based on
504
+ * @param account login details, supplied by the consumer of this library; only `username` is used
505
+ */
375
506
  static getEHerkenningVestigingFileName(browser, account) {
376
507
  return path.join(sessionsDir, `${browser.browserType().name()}-eherkenning-vestiging-${environment}-${account.username}.json`);
377
508
  }
509
+ /**
510
+ * @param browser the browser instance the session file name is based on
511
+ * @param account login details, supplied by the consumer of this library; only `username` is used
512
+ */
378
513
  static getEHerkenningBewindvoerderFileName(browser, account) {
379
514
  return path.join(sessionsDir, `${browser.browserType().name()}-eherkenning-bewindvoerder-${environment}-${account.username}.json`);
380
515
  }
516
+ /**
517
+ * @param browser the browser instance the session file name is based on
518
+ * @param account login details, supplied by the consumer of this library; only `username` is used
519
+ */
381
520
  static getADFileName(browser, account) {
382
521
  return path.join(sessionsDir, `${browser.browserType().name()}-ad-${environment}-${account.username}.json`);
383
522
  }
@@ -390,7 +529,7 @@ var MAX_SESSION_TIME_IN_MINUTES = 10;
390
529
  * It will also perform the process of setting op the session
391
530
  *
392
531
  * @param authType type of login
393
- * @param account with login details
532
+ * @param account login details, supplied by the consumer of this library
394
533
  * @param loginHandler that will handle the login itself
395
534
  */
396
535
  function createSessionHandler(authType, account, loginHandler) {
@@ -516,8 +655,14 @@ function getApiTokenFromSession(baseTest, handler) {
516
655
  }
517
656
  //#endregion
518
657
  //#region src/auth/getSessionHandler.ts
519
- function getSessionHandler(testProfile) {
520
- return createSessionHandler(testProfile.authType, testProfile.account, getLoginHandler(testProfile.authType));
658
+ /**
659
+ * @param testProfile
660
+ * @param adTargetUrl URL to navigate to before logging in when `testProfile.authType` is
661
+ * `'ad-session'` (the app behind the firewall), supplied by the consumer of this library.
662
+ * Required in that case, ignored otherwise.
663
+ */
664
+ function getSessionHandler(testProfile, adTargetUrl) {
665
+ return createSessionHandler(testProfile.authType, testProfile.account, getLoginHandler(testProfile.authType, adTargetUrl));
521
666
  }
522
667
  //#endregion
523
668
  export { ADLoginHandler, ADLoginPage, DigidGemachtigdeLoginHandler, DigidLoginHandler, DigidLoginPage, EHerkenningBewindvoerderLoginHandler, EHerkenningLoginHandler, EHerkenningLoginPage, LocalhostLoginHandler, LoginOverzichtPage, MAX_SESSION_TIME_IN_MINUTES, SessionFileHelper, createSessionHandler, getApiTokenFromSession, getLoginHandler, getSessionHandler };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dh-auth-library",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Gemeente-DenHaag/dh-auth-library.git"