Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
b95aba5
feat: add DPoP core storage layer (ENG-4782)
mrudatsprint Jul 15, 2026
9f3e0bc
feat: fix file formatting.
mrudatsprint Jul 15, 2026
7738bb4
fix: DPoPStorage openDb() error handling and test coverage
mrudatsprint Jul 15, 2026
d386a32
fix: fix copilot warnings.
mrudatsprint Jul 15, 2026
bd37ddf
fix: resolve DPoP transactions on tx.oncomplete, not req.onsuccess
mrudatsprint Jul 16, 2026
d91e5b7
feat: the workflow will run regardless of the branch being merged into.
mrudatsprint Jul 16, 2026
7eeb367
feat: implement DPoPManager central coordinator (ENG-4784)
mrudatsprint Jul 16, 2026
06a557e
feat: re-generate lock file.
mrudatsprint Jul 16, 2026
00a0acb
feat: re-generate lock file.
mrudatsprint Jul 16, 2026
14b9b4a
feat: update lock file.
mrudatsprint Jul 16, 2026
e9a8048
Merge branches 'miker/eng-4784/central-coordinator' and 'miker/eng-47…
mrudatsprint Jul 16, 2026
ec6372e
test: add DPoP smoke tests against real FusionAuth instance (pre-SDKC…
mrudatsprint Jul 16, 2026
324d970
feat: fix format and lint errors.
mrudatsprint Jul 17, 2026
952cd03
refactor: make DPoPStorage IndexedDB constants configurable via confi…
mrudatsprint Jul 17, 2026
b7e6feb
feature: delete contrived test to intercept a successful even and the…
mrudatsprint Jul 17, 2026
2c27865
Merge branch 'miker/eng-4782/core-storage-layer' into miker/eng-4784/…
mrudatsprint Jul 17, 2026
b5601e2
fix: update DPoPStorage constructor calls to use config object after …
mrudatsprint Jul 17, 2026
252322a
feature: update lock file
mrudatsprint Jul 17, 2026
eb01796
feat: implement SDKCore.startLogin() for DPoP authorization code gran…
mrudatsprint Jul 18, 2026
ce41545
fix: add @vitest-environment jsdom to SDKCore.test.ts; fix handlePreR…
mrudatsprint Jul 18, 2026
f29df57
fix: suppress cookie console.error noise in Tier 0 e2e tests
mrudatsprint Jul 18, 2026
7babfae
feat: update lock file.
mrudatsprint Jul 18, 2026
bfc666a
fix: update Angular onRedirect test to use 3-segment redirect-value f…
mrudatsprint Jul 18, 2026
27b9ab6
fix: update Vue and React onRedirect tests to use 3-segment redirect-…
mrudatsprint Jul 18, 2026
14c1d0c
fix: merge Request and init headers in DPoPManager.fetch() instead of…
mrudatsprint Jul 20, 2026
b1567a6
feat: fix angular and vue tests.
mrudatsprint Jul 20, 2026
f7cefc8
fix: clone Request before retry in fetch() to avoid double body consu…
mrudatsprint Jul 20, 2026
ddb5509
fix: normalize htu and htm in generateProof() per RFC 9449 (PR #202 C…
mrudatsprint Jul 20, 2026
185357c
fix: remove dead captured header variables and misleading comment in …
mrudatsprint Jul 20, 2026
098bbfb
feat: update approvers.
mrudatsprint Jul 20, 2026
13db934
feat: fix merge conflict.
mrudatsprint Jul 20, 2026
2b6e6de
feat: fix failing tests.
mrudatsprint Jul 20, 2026
920081d
test: add deterministic nonce-retry smoke test (T2-4)
mrudatsprint Jul 20, 2026
b711f2d
fix: revert startLogin() to void, address Copilot PR review comment (…
mrudatsprint Jul 20, 2026
8cfc607
docs: fix stale/ambiguous state-reconstruction description in Redirec…
mrudatsprint Jul 20, 2026
a03dd2e
fix: preserve state from legacy 2-segment redirect values (Copilot PR…
mrudatsprint Jul 21, 2026
50b852f
feat: update comments.
mrudatsprint Jul 21, 2026
8f8f5bc
feat: SDKCore: implement handlePostRedirect() authorization code exch…
mrudatsprint Jul 21, 2026
d5f4569
feat: remove references to ENG- linear issues.
mrudatsprint Jul 21, 2026
5f517f0
feat: remove redundant comments.
mrudatsprint Jul 21, 2026
1f4de60
feat: merge and remove verbose comments.
mrudatsprint Jul 22, 2026
aa7bbdc
feat: merge in the parent branch.
mrudatsprint Jul 22, 2026
9acf888
feat: remove file not needed until adding end to end tests.
mrudatsprint Jul 22, 2026
24b7337
feat: remove lengthy comment.
mrudatsprint Jul 22, 2026
e5342e3
feat: remote unnecessary comments.
mrudatsprint Jul 22, 2026
ac12953
feat: merge in the parent branch.
mrudatsprint Jul 22, 2026
81f46f4
feat: remove verbose comment.
mrudatsprint Jul 22, 2026
ab79bf8
feat: copilot review warnings.
mrudatsprint Jul 22, 2026
fd4353e
feat: failing smoke test.
mrudatsprint Jul 22, 2026
d138ca3
feat: minimize verbose comments.
mrudatsprint Jul 22, 2026
0232d82
feat: clean up comments.
mrudatsprint Jul 22, 2026
1a58211
feat: minimize verbose comments.
mrudatsprint Jul 22, 2026
44cd888
feat: SDKCore - implement startLogout() and getAccessToken() for DPoP…
mrudatsprint Jul 23, 2026
595c4e4
feat: rebuild the lock file.
mrudatsprint Jul 23, 2026
ff619a3
feat: remove verbose comments.
mrudatsprint Jul 23, 2026
16859d9
feat: remove verbose comments.
mrudatsprint Jul 23, 2026
711c709
feat: SDKCore - implement refreshToken() for DPoP mode (ENG-4801)
mrudatsprint Jul 24, 2026
e3e174a
feat: refresh token grant
mrudatsprint Jul 24, 2026
78cf20d
feat: remove verbose comments.
mrudatsprint Jul 24, 2026
5bef47a
chore: upgrade vitest to v3.2.6 for core, lexicon, and sdk-react
mrudatsprint Jul 24, 2026
20d66a8
feat: add DPoP to the React SDK, sync the version of vitest being use…
mrudatsprint Jul 24, 2026
4d8985d
Merge branch 'parent/dpop-in-the-javascript-sdk' into miker/eng-4800/…
mrudatsprint Jul 26, 2026
4a990cf
feat: copilot recommendation .
mrudatsprint Jul 27, 2026
c5e1f35
feat: cleanup comments.
mrudatsprint Jul 27, 2026
31cb1ad
feat: reduce commenting.
mrudatsprint Jul 27, 2026
46984e9
Merge branch 'miker/eng-4800/code-grant-finish' into miker/eng-4802/s…
mrudatsprint Jul 27, 2026
7861863
feat: insure logout url is called.
mrudatsprint Jul 27, 2026
ed1f063
feat: use hosted backend mode versus cookie mode in comments.
mrudatsprint Jul 27, 2026
e716fee
feat: remove verbose comments.
mrudatsprint Jul 27, 2026
fe643bf
Merge branch 'parent/dpop-in-the-javascript-sdk' into miker/eng-4802/…
mrudatsprint Jul 28, 2026
6455306
Merge branch 'miker/eng-4802/start-logout' into miker/eng-4801/refres…
mrudatsprint Jul 28, 2026
210dbf8
feat: update from the last merge.
mrudatsprint Jul 28, 2026
617826e
feat: remove comment verbosity.
mrudatsprint Jul 28, 2026
f8c2e59
feat: remove comment verbosity.
mrudatsprint Jul 28, 2026
4298efe
Merge branch 'miker/eng-4801/refresh-token' into mike/eng-4787/dpop-sdks
mrudatsprint Jul 28, 2026
a19cf50
feat: reduce verbose commenting.
mrudatsprint Jul 28, 2026
6797302
fix: address Copilot review comments on refreshDpopToken() (PR #206)
mrudatsprint Jul 28, 2026
f90d545
feat: preserve the existing refresh token, if needed.
mrudatsprint Jul 28, 2026
3960681
fix: reapply refreshDpopToken() Copilot fixes lost in the eng-4801 merge
mrudatsprint Jul 28, 2026
b5e1de4
fix: DPoP mode startLogout() targets /oauth2/logout directly
mrudatsprint Jul 28, 2026
d14345a
test: add DPoP endpoint e2e tests (dpop-endpoints.test.ts)
mrudatsprint Jul 28, 2026
c8ada31
feat: SDKCore.fetchUserInfo() is DPoP aware (ENG-4931)
mrudatsprint Jul 29, 2026
12d466c
feat: cleanup
mrudatsprint Jul 29, 2026
e0cca73
feat: test user info endpoint.
mrudatsprint Jul 29, 2026
4b3a38d
fix: React SDK auto-fetches userInfo after async DPoP login, not just…
mrudatsprint Jul 29, 2026
d4263c7
test: merge userinfo check into the auto-refresh test
mrudatsprint Jul 29, 2026
02ed28a
debug: temporary diagnostics for the /oauth2/userinfo investigation
mrudatsprint Jul 29, 2026
f9c6ffe
Revert "debug: temporary diagnostics for the /oauth2/userinfo investi…
mrudatsprint Jul 29, 2026
0d90540
docs: document the FusionAuth CORS prerequisite for /oauth2/userinfo
mrudatsprint Jul 29, 2026
0258a16
feat: remove verbose comments.
mrudatsprint Jul 29, 2026
af93031
fix: prevent duplicate DPoP authorization code exchange on concurrent…
mrudatsprint Jul 29, 2026
cef6017
feat: cleanup duplicate code grant exchanges being tracket.
mrudatsprint Jul 29, 2026
bea8a4b
Merge branch 'parent/dpop-in-the-javascript-sdk' into miker/eng-4801/…
mrudatsprint Jul 29, 2026
37c3c35
fix: dpop-smoke.test.ts refresh token test — undefined var + wrong order
mrudatsprint Jul 29, 2026
3417fc2
feat: parent merge
mrudatsprint Jul 29, 2026
2924951
feat: The Angular Framework has is using the DPoP functionality in th…
mrudatsprint Jul 30, 2026
0b98e9c
feat: The Vue Framework using DPoP.
mrudatsprint Jul 30, 2026
52188c8
feat: the VUE framework using DPoP.
mrudatsprint Jul 30, 2026
1cce4e5
feat: remove verbose comments.
mrudatsprint Jul 31, 2026
9c97883
feat: remove verbose comments.
mrudatsprint Aug 1, 2026
f0ca26c
feat: remove test duplication.
mrudatsprint Aug 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,9 @@ Tests import these page objects to perform actions, ensuring that if the UI chan

### DPoP E2E tests

There are two separate DPoP-related test files, each with their own prerequisites:

- `e2e/tests/dpop-smoke.test.ts` — exercises `DPoPManager`/`UrlHelper`/`SDKCore` directly against a live FusionAuth instance. No consuming quickstart application is required. Run with:
```
npx playwright test e2e/tests/dpop-smoke.test.ts --config playwright.dpop.config.ts
```
- `e2e/tests/dpop-endpoints.test.ts` — mirrors `endpoints.test.ts`, but drives a consuming quickstart application configured with `useDpop: true` through its UI. Since DPoP mode has no hosted backend mode (`SDKCore` talks directly to FusionAuth), this only covers the login / authorization-code-exchange flow — see the file header for the current coverage gaps (Logout/Register/Refresh/user-info aren't DPoP-aware in `SDKCore` yet). Run with a DPoP-enabled quickstart instance:
`e2e/tests/dpop-endpoints.test.ts` — mirrors `endpoints.test.ts`, but drives a consuming quickstart application configured with `useDpop: true` through its UI. Since DPoP mode has no hosted backend mode (`SDKCore` talks directly to FusionAuth), this validates the *direct* calls to `/oauth2/authorize`, `/oauth2/token` (both the authorization code exchange and the refresh token grant), `/oauth2/userinfo`, and `/oauth2/logout`:
```
SERVER_COMMAND="your-dpop-quickstart-start-command" PORT=your-port-number npx playwright test e2e/tests/dpop-endpoints.test.ts
SERVER_COMMAND="your-dpop-quickstart-start-command" PORT=your-port-number npx playwright test e2e/tests/dpop-endpoints.test.ts --config playwright.dpop-endpoints.config.ts
```
This must be run on its own — it cannot be combined with `endpoints.test.ts` / `cookies.test.ts` in the same invocation, since those require a hosted backend mode quickstart instance instead.

Expand Down
13 changes: 10 additions & 3 deletions e2e/pages/common.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ export class quickstartPage {
await this.locators.passwordInput.clear();
await this.locators.passwordInput.fill('password');
await this.locators.submitBtn.click();
// Wait for the full OAuth callback chain to complete (form POST → /app/callback
// code exchange → redirect back to the app). Without this, webkit doesn't finish
// committing the session cookies before the test body reads them.
await expect(this.locators.logOutBtn).toBeVisible();
await this.page.waitForLoadState('load');
}

async navToRegister() {
Expand All @@ -52,7 +50,16 @@ export class quickstartPage {
}

async logOut() {
const logoutNavigationPromise = this.page.waitForURL(
url => /\/(oauth2|app)\/logout/.test(url.pathname),
{ timeout: 10_000 },
);

await this.locators.logOutBtn.click();
await logoutNavigationPromise;

await expect(this.locators.logInBtn.nth(0)).toBeVisible();
// See the comment in authenticate() above.
await this.page.waitForLoadState('load');
}
}
197 changes: 197 additions & 0 deletions e2e/tests/dpop-endpoints.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
/**
* DPoP Endpoint Tests
*
* Mirrors `endpoints.test.ts`, but for a consuming quickstart application
* configured with `useDpop: true`. Since DPoP mode has no hosted backend to
* proxy through (`SDKCore` talks directly to FusionAuth), these tests
* validate the *direct* calls to FusionAuth's `/oauth2/authorize`,
* `/oauth2/token`, `/oauth2/userinfo`, and `/oauth2/logout` endpoints, and
* check for tokens in `localStorage` instead of `app.*` HttpOnly cookies.
*
* Run with:
* SERVER_COMMAND="your-dpop-quickstart-start-command" PORT=your-port-number \
* npx playwright test e2e/tests/dpop-endpoints.test.ts \
* --config playwright.dpop-endpoints.config.ts
*
* Prerequisites:
* - A consuming quickstart application (e.g. fusionauth-quickstart-javascript-react-web)
* configured with `useDpop: true`, `shouldAutoRefresh: true`, and
* `shouldAutoFetchUserInfo: true`
* - short access token (JWT) lifetime configured — e.g. 30-60 seconds —
* so the auto-refresh test below doesn't need a long wall-clock wait.
* Set `autoRefreshSecondsBeforeExpiry` so the refresh fires comfortably
* before expiry (e.g. 20s before a 30s token lifetime).
* - CORS must be configured in FusionAuth (Settings -> System -> CORS)
* to allow the quickstart's origin (e.g. http://localhost:3000) to call
* `/oauth2/userinfo` directly: enable the filter, add the origin to
* Allowed origins, and add `DPoP` and `Authorization` to Allowed
* headers. Without this, the userinfo request's CORS preflight fails
* with "No 'Access-Control-Allow-Origin' header is present"
*/

import { Page, test, BrowserContext, expect } from '@playwright/test';
import { quickstartPage } from '../pages/common.page';

interface DPoPTokens {
accessToken: string;
refreshToken?: string;
expiresAt: number;
tokenType: string;
}

async function readDpopTokens(page: Page): Promise<DPoPTokens | null> {
const evaluateTokens = () =>
page.evaluate(() => {
const key = Object.keys(localStorage).find(k =>
k.startsWith('fusionauth-sdk:tokens:'),
);
return key ? localStorage.getItem(key) : null;
});

let raw: string | null;
try {
raw = await evaluateTokens();
} catch (error) {
if (
error instanceof Error &&
error.message.includes('Execution context was destroyed')
) {
await page.waitForLoadState('load');
raw = await evaluateTokens();
} else {
throw error;
}
}
return raw ? JSON.parse(raw) : null;
}

test.describe('DPoP Endpoint Tests', () => {
test.describe.configure({ mode: 'serial' });

let page: Page;
let quickstart: quickstartPage;
let browserContext: BrowserContext;

test.beforeAll(async ({ browser }) => {
browserContext = await browser.newContext();
page = await browserContext.newPage();
quickstart = new quickstartPage(page);
});

test.afterAll(async () => {
await page?.close();
await browserContext?.close();
});

test.beforeEach(async () => {
await page.goto('/');
});

test('Login redirects directly to /oauth2/authorize with dpop_jkt and code_challenge, then exchanges the code at /oauth2/token', async () => {
await quickstart.navToLogIn();

const authorizeUrl = new URL(page.url());
expect(authorizeUrl.pathname).toBe('/oauth2/authorize');
expect(authorizeUrl.searchParams.get('response_type')).toBe('code');
expect(authorizeUrl.searchParams.get('code_challenge_method')).toBe('S256');

const dpopJkt = authorizeUrl.searchParams.get('dpop_jkt');
const codeChallenge = authorizeUrl.searchParams.get('code_challenge');
expect(dpopJkt).toBeTruthy();
expect(codeChallenge).toBeTruthy();

const tokenExchangeResponsePromise = page.waitForResponse(
response =>
response.url().includes('/oauth2/token') &&
response.request().method() === 'POST',
);

await quickstart.authenticate();

const tokenExchangeResponse = await tokenExchangeResponsePromise;
const tokenExchangeRequest = tokenExchangeResponse.request();
expect(new URL(tokenExchangeRequest.url()).pathname).toBe('/oauth2/token');
expect(tokenExchangeRequest.headers()['dpop']).toBeTruthy();

const body = new URLSearchParams(tokenExchangeRequest.postData() ?? '');
expect(body.get('grant_type')).toBe('authorization_code');
expect(body.get('code_verifier')).toBeTruthy();

const tokens = await readDpopTokens(page);
expect(tokens).not.toBeNull();
expect(tokens!.tokenType).toBe('DPoP');
expect(tokens!.accessToken).toBeTruthy();

const cookies = await browserContext.cookies();
['app.at', 'app.idt', 'app.rt', 'app.at_exp'].forEach(name => {
expect(cookies.find(cookie => cookie.name === name)).toBeUndefined();
});

await quickstart.logOut();
});

test('User info is fetched after login, and the access token auto-refreshes via a direct /oauth2/token refresh_token grant', async () => {
// The refresh window depends on the FusionAuth Application's configured
// access token lifetime and the quickstart's autoRefreshSecondsBeforeExpiry.
test.setTimeout(90_000);

await quickstart.navToLogIn();

const userInfoResponsePromise = page.waitForResponse(response =>
Comment thread
mrudatsprint marked this conversation as resolved.
response.url().includes('/oauth2/userinfo'),
);

await quickstart.authenticate();

const userInfoResponse = await userInfoResponsePromise;
const userInfoRequest = userInfoResponse.request();
expect(new URL(userInfoRequest.url()).pathname).toBe('/oauth2/userinfo');
expect(userInfoRequest.headers()['dpop']).toBeTruthy();
expect(userInfoResponse.ok()).toBe(true);

await expect(page.getByText('richard@example.com')).toBeVisible();

const initialTokens = await readDpopTokens(page);
expect(initialTokens).not.toBeNull();

const refreshResponse = await page.waitForResponse(
response =>
response.url().includes('/oauth2/token') &&
(response.request().postData() ?? '').includes(
'grant_type=refresh_token',
),
{ timeout: 60_000 },
);

const refreshRequest = refreshResponse.request();
expect(refreshRequest.headers()['dpop']).toBeTruthy();
const body = new URLSearchParams(refreshRequest.postData() ?? '');
expect(body.get('refresh_token')).toBeTruthy();

const refreshedTokens = await readDpopTokens(page);
expect(refreshedTokens).not.toBeNull();
expect(refreshedTokens!.accessToken).not.toBe(initialTokens!.accessToken);

await quickstart.logOut();
});

test('Logout redirects directly to /oauth2/logout and clears local DPoP state', async () => {
await quickstart.navToLogIn();
await quickstart.authenticate();

expect(await readDpopTokens(page)).not.toBeNull();

const logoutRequestPromise = page.waitForRequest(request =>
request.url().includes('/oauth2/logout'),
);

await quickstart.logOut();

const logoutRequest = await logoutRequestPromise;
const logoutUrl = new URL(logoutRequest.url());
expect(logoutUrl.pathname).toBe('/oauth2/logout');
expect(logoutUrl.searchParams.get('client_id')).toBeTruthy();

expect(await readDpopTokens(page)).toBeNull();
});
});
Loading
Loading