Skip to content

credential: Pass request handle to the handler - #1

Open
dangerousplay wants to merge 3 commits into
linux-credentials:credentials-portalfrom
dangerousplay:credential-request-handle
Open

dangerousplay wants to merge 3 commits into
linux-credentials:credentials-portalfrom
dangerousplay:credential-request-handle

Conversation

@dangerousplay

@dangerousplay dangerousplay commented Oct 17, 2026 •

Copy link
Copy Markdown

Hi, I hope you are having a good day ^^

When a client closes its Credential request or disconnects, the handler is never told, so the ceremony keeps running and its UI stays open.

  • Pass the request path to the handler as a request_handle (o) entry in the options of CreateCredential/GetCredential. The handler exports org.freedesktop.handler.portal.experimental.Request there for the duration of the call.
  • Add a closed signal to XdpRequest, emitted when the client calls Close() on its request or disconnects.
  • In the Credential portal, call Close() on the handler's request from that signal. This replaces forwarding through an org.freedesktop.impl.portal.Request proxy, since the handler interface is internal and not a regular backend.

The option keeps old handlers working. credentialsd support: linux-credentials/credentialsd#246.

Tested by running the built portal against a mock handler on a private bus: both Request.Close() and a client disconnect result in Close() on the handler's request object.

The handler is asked to Close() the impl Request at request->id when
the client closes the request or disconnects, but it was never told
that path. Pass it as the `request_handle` option so the handler can
export org.freedesktop.impl.portal.Request there and cancel the
in-flight ceremony.

@iinuwa iinuwa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a little bit more machinery: we need to hook into the closed signal and call the handler's Close() method from there. portal clients shouldn't call the handler's Close() method directly.

When the caller closes its request or disconnects, the request forwards
Close() to the backend through its org.freedesktop.impl.portal.Request
proxy. Portals that delegate to a handler with a different request
interface have no way to learn about it.

Emit a "closed" signal in both cases, so that such portals can cancel
the call on their side.

Assisted-by: Claude:claude-opus-5-5
The handler interface is internal to the frontend and credentialsd, so
the object the handler exports at `request_handle` should not look like
a regular backend request. Add
org.freedesktop.handler.portal.experimental.Request with a Close()
method, and call it from the XdpRequest "closed" signal instead of
forwarding Close() through an org.freedesktop.impl.portal.Request proxy.

Document the `request_handle` option in the handler interface.

Assisted-by: Claude:claude-opus-5-5
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.

2 participants