Fix #738: Support user certificate authentication in UA Sample Client - #748
Merged
Conversation
Wire up the <Browse...> entry to open a certificate picker and build an X509 user identity so certificate-based authentication works. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Proposed changes
When connecting to a server whose endpoint offers an X509 (certificate) user identity token, the UA Sample Client could not authenticate with a user certificate. Selecting Certificate showed a
<Browse...>entry, but nothing happened: no picker opened and the session was opened with anullidentity (effectively anonymous), so certificate authentication never occurred.This wires up the missing behavior in
SessionOpenDlg:<Browse...>entry now opens a certificate picker (X509Certificate2UI.SelectFromCollectionoverCurrentUser\My, filtered to certificates that have a private key). The chosen certificate's subject is shown and selected in the combo box.OkBTN_Clickgained aCertificatebranch that builds a realUserIdentityfrom anX509IdentityToken(using the selected certificate's raw data) and passes it tosession.OpenAsync(...). It also guards against confirming without a selected certificate.The approach mirrors the existing certificate-impersonation flow in the UserAuthentication workshop client, keeping the sample consistent.
Related Issues
Types of changes
Checklist
Further comments
This is a WinForms sample dialog, so the fix is validated by a clean Release build (0 errors, no new warnings on the changed file) rather than automated tests. The picker is scoped to the CurrentUser\My store and only offers certificates with an available private key, since a private key is required for X509 user authentication.