Skip to content

Make login work for clients with a Client Identifier Document - #233

Open
chefboyrdave21 wants to merge 1 commit into
pdsinterop:mainfrom
smilinTux:fix/client-id-document-consent
Open

chefboyrdave21 wants to merge 1 commit into
pdsinterop:mainfrom
smilinTux:fix/client-id-document-consent

Conversation

@chefboyrdave21

Copy link
Copy Markdown

Problem

Clients that identify themselves with a URL (a Solid-OIDC Client Identifier Document, as Penny and most current Solid apps do) cannot complete login:

  1. authorize() saves a new registration with a random client ID on every request, so the user's approval never applies to the next request.
  2. After approval the user is sent to the client's redirect_uri instead of back to the authorization request, so the app gets no code and starts over (and gets a new registration that needs approval again).
  3. createAuthServerConfig() configures the authorization server with an empty client for a URL client_id, so even an approved request fails with 401 because no redirect URI is registered for it.

Fix

  • BaseServerConfig::getClientIdDocumentRegistration() derives one registration from the client_id URL and the redirect URI (so an approval is bound to that redirect URI).
  • authorize() uses it, and returns to the authorization request after approval, as for other clients.
  • createAuthServerConfig() uses its redirect URIs while keeping the URL as the client identifier the code is issued to.

The Client Identifier Document itself is still not fetched; that is the existing FIXME and would be a good follow-up.

Tests

testAuthorizeWithClientIdDocumentUsesStableRegistration: two authorization requests create one registration, give the same approval URL, and the approval returns to the authorization request.

Verification

Verified on Nextcloud 35.0.2 (PHP 8.5) behind a reverse proxy that terminates TLS, with @inrupt/solid-client-authn-node 5.0.3 / @inrupt/solid-client 4.0.0 and in a headless browser. The unit suite passes in a Nextcloud 35 container. Penny (hosted) logs in, then lists and reads a private container. Without the change it returns to Penny without a code after approval.

🤖 Generated with Claude Code

When a client identifies itself with a URL (a Solid-OIDC Client
Identifier Document, as Penny and most current Solid apps do), login
could not complete:

- authorize saved a new registration with a random client ID on every
  request, so the user's approval never applied to the next request;
- after approval the user was sent to the client's redirect URI instead
  of back to the authorization request, so the app got no code;
- the authorization server was configured with an empty client for the
  URL client_id, so even an approved request failed with 401 because no
  redirect URI was registered for it.

Derive one registration from the client_id URL and the redirect URI, use
it for the approval (which is then bound to that redirect URI) and for
the authorization server's client, keep the URL as the client identifier
the code is issued to, and return to the authorization request after
approval, as for other clients.

The Client Identifier Document itself is still not fetched; that remains
the existing FIXME.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant