Repository navigation
Make login work for clients with a Client Identifier Document - #233
Open
chefboyrdave21 wants to merge 1 commit into
Open
chefboyrdave21 wants to merge 1 commit into
chefboyrdave21 wants to merge 1 commit into
Conversation
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
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.
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:
authorize()saves a new registration with a random client ID on every request, so the user's approval never applies to the next request.redirect_uriinstead of back to the authorization request, so the app gets no code and starts over (and gets a new registration that needs approval again).createAuthServerConfig()configures the authorization server with an empty client for a URLclient_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-node5.0.3 /@inrupt/solid-client4.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