feat: swap @inrupt/solid-client-authn-browser for @uvdsl/solid-oidc-client-browser#275
Open
m5x5 wants to merge 3 commits into
Open
feat: swap @inrupt/solid-client-authn-browser for @uvdsl/solid-oidc-client-browser#275m5x5 wants to merge 3 commits into
m5x5 wants to merge 3 commits into
Conversation
…lient-browser Wraps uvdsl's default WebWorkerSession in a thin Inrupt-shape adapter inside authSession.ts so downstream call sites (panes, solid-ui) keep working unchanged. The SharedWorker provides background token refresh and cross-tab token sharing — the intended uvdsl usage for web apps. Refs SolidOS#274 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…t parseable by jest/jsdom)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates SolidOS/solid-logic’s browser authentication from Inrupt’s @inrupt/solid-client-authn-browser to @uvdsl/solid-oidc-client-browser, introducing an adapter so existing consumers can keep using the Inrupt-shaped Session API while gaining uvdsl’s refresh/token persistence + SharedWorker-based background refresh.
Changes:
- Replaced the Inrupt auth dependency with
@uvdsl/solid-oidc-client-browserand updated internal imports to use a new adapterSession. - Added a thin
Sessionadapter that preserves thesession.info / session.events / session.fetch / session.login / session.logout / session.handleIncomingRedirectsurface. - Updated build/test plumbing: webpack externalizes
@uvdsl/...(to avoid broken worker URLs) and Jest stubs the uvdsl module for unit tests.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| webpack.config.mjs | Externalizes @uvdsl/solid-oidc-client-browser to keep SharedWorker URL resolution correct in the consumer bundle. |
| test/helpers/setup.ts | Mocks the uvdsl module in Jest to avoid import.meta.url/SharedWorker issues under jsdom. |
| src/types.ts | Switches exported Session type reference to the new adapter. |
| src/logic/solidLogic.ts | Uses the adapter Session type in logic construction. |
| src/authSession/authSession.ts | Introduces the uvdsl-backed Inrupt-shaped Session adapter + event bridge. |
| src/authn/SolidAuthnLogic.ts | Updates imports to use adapter Session/EVENTS. |
| package.json | Replaces @inrupt/solid-client-authn-browser with @uvdsl/solid-oidc-client-browser. |
| package-lock.json | Updates lockfile to reflect the dependency swap. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+20
to
+24
| private ensure(redirect?: string) { | ||
| return this.inner ||= new UvdslSession( | ||
| { client_name: 'SolidOS', redirect_uris: [redirect || location.origin + location.pathname] } as any, | ||
| { database: new SessionIDB() } as any, | ||
| ) |
|
|
||
|
No newline at end of file |
||
| async login(opts: { oidcIssuer: string; redirectUrl?: string }) { | ||
| const r = opts.redirectUrl || location.href |
Comment on lines
+17
to
+18
| private emit(n: string, ...a: any[]) { | ||
| this.subs[n]?.forEach(cb => { try { cb(...a) } catch (_) {} }) |
Comment on lines
+42
to
+53
| async handleIncomingRedirect(opts?: { restorePreviousSession?: boolean; url?: string }) { | ||
| const url = new URL(opts?.url || location.href) | ||
| const s = this.ensure() | ||
| if (url.searchParams.has('code') && url.searchParams.has('state')) { | ||
| await s.handleRedirectFromLogin() | ||
| for (const k of ['code', 'state', 'iss']) url.searchParams.delete(k) | ||
| try { history.replaceState(null, '', url.toString()) } catch (_) {} | ||
| if (s.isActive) this.emit('login') | ||
| } else if (opts?.restorePreviousSession !== false) { | ||
| await s.restore() | ||
| if (s.isActive) this.emit('sessionRestore', url.toString()) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@inrupt/solid-client-authn-browserdependency with@uvdsl/solid-oidc-client-browser(the library recommended in Switch out authentication library #274).Session(WebWorkerSession) in a thin Inrupt-shape adapter living insrc/authSession/authSession.ts, so downstream call sites (SolidAuthnLogic,solidLogic,types, plus solid-ui's footer/header/login) keep their existingsession.info/session.events/session.fetch/session.login/session.logout/session.handleIncomingRedirectsurface — no consumer changes needed.SessionIDBfor refresh-token + DPoP-keypair persistence and the bundled SharedWorker for background refresh + cross-tab token sharing (the intended uvdsl architecture).@uvdsl/...in the webpack config so the SharedWorker URL is constructed in the consumer bundle (mashlib) with the rightpublicPath— bundling inline causes webpack to bake afile://worker URL the browser refuses to load.Refs #274
Coordinated PRs
Verified end-to-end against a local CSS pod: fresh login + multiple reloads keep the user logged in via uvdsl's RefreshTokenGrant, no
?code=redirect round-trip, no console errors.