Skip to content

Conversation

@p3dr0rv
Copy link
Contributor

@p3dr0rv p3dr0rv commented Sep 23, 2025

AB#3385532
https://identitydivision.visualstudio.com/DevEx/_git/AuthLibrariesApiReview/pullrequest/20357

This PR implements passkey registration support for MSAL/Broker/OneAuth on Android WebView through a WebMessageListener bridge. It extends the existing authentication-only passkey functionality to include full registration capabilities, leveraging the standard Android Credential Manager.

🎯 Key Features
Protocol Version Update

  • Current: x-ms-PassKeyAuth: 1.0/passkey (authentication only)
  • New: x-ms-PassKeyAuth: 1.1/passkey (registration + authentication)

Passkey and Credential Manager Integration:

  • Added new CredentialManagerHandler class to encapsulate passkey creation and retrieval using the Android Credential Manager API, including version checks and logging. This simplifies and centralizes interactions with the credential APIs.
  • Introduced PasskeyReplyChannel class to standardize communication of WebAuthn responses (success and error) back to JavaScript via JavaScriptReplyProxy, with detailed error mapping to DOMException types per the WebAuthn specification.

Protocol Version Handling:

  • Updated protocol version validation in FidoChallengeField to accept both 1.0 and 1.1 as supported passkey protocol versions, improving compatibility with newer protocol versions.

Dependency Management:

  • Added androidx.webkit:webkit as a dependency to support enhanced WebView and JavaScript interaction features.

Telemetry will be added in following PR

@p3dr0rv p3dr0rv changed the title Add passkey support with CredentialManager and WebView integration [WIP] Add passkey support with CredentialManager and WebView integration Sep 23, 2025
@github-actions
Copy link

❌ Work item link check failed. Description does not contain AB#{ID}.

Click here to Learn more.

- Set project-level archives name in build.gradle
- Improve PasskeyWebListener to set up WebView message listener
- Refactor WebViewAuthorizationFragment to handle console messages with logging levels
- Update request headers management in WebViewAuthorizationFragment for passkey protocol
- Clean up WebViewMessageListener by removing unused default listener
…oved script handling and logging; add JsScriptRecord for script management; update CommonFlight to disable passkey feature by default.
…rieval logging; streamline credential request handling.
- Added PasskeyReplyChannel for communication between JavaScript and native code.
- Updated CredentialManagerHandler to create and retrieve passkeys.
- Enhanced PasskeyWebListener to handle WebAuthn requests and responses.
- Introduced js-bridge.js for JavaScript integration with WebAuthn.
- Created unit tests for PasskeyReplyChannel to ensure correct message formatting and error handling.
- Removed unnecessary logging statements and improved error handling.
…r handling and message formatting; enhance test coverage for success and error scenarios.
…te Logger class to disable Logcat logging by default; improve logging conditions in Logger.java; ensure proper newline at end of files in CredentialManagerHandler and JsScriptRecord.
…ract Passkey protocol header injection logic into a separate method for improved readability and maintainability.
… with project property for better version management.

Refactor FidoChallengeField to support multiple Passkey protocol versions; improve error handling for unsupported versions.
Clean up CredentialManagerHandler by removing unnecessary exception handling; streamline credential creation and retrieval logic.
Add unit tests for PasskeyWebListener; cover message handling, credential flows, and error scenarios.
Add webkitVersion variable in versions.gradle for centralized version management.
…ent; streamline logic for injecting headers based on flight feature and broker requests.
@p3dr0rv p3dr0rv changed the title [WIP] Add passkey support with CredentialManager and WebView integration Add passkey registration support with CredentialManager and WebView integration Oct 23, 2025
@p3dr0rv p3dr0rv changed the title Add passkey registration support with CredentialManager and WebView integration Add passkey registration support for WebView Oct 23, 2025
@github-actions
Copy link

✅ Work item link check complete. Description contains link AB#3385532 to an Azure Boards work item.

@github-actions github-actions bot changed the title Add passkey registration support for WebView Add passkey registration support for WebView, Fixes AB#3385532 Oct 23, 2025
@shahzaibj shahzaibj requested a review from Copilot October 29, 2025 16:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.

@p3dr0rv p3dr0rv added the Skip-Consumers-Check Only include this if making a breaking change purposefully, and there is an MSAL/ADAL/Broker PR label Nov 6, 2025
@p3dr0rv p3dr0rv merged commit e447086 into dev Nov 6, 2025
18 of 20 checks passed
@p3dr0rv p3dr0rv deleted the pedroro/passkey-reg-prototype branch November 6, 2025 21:54
p3dr0rv added a commit to AzureAD/microsoft-authentication-library-for-android that referenced this pull request Nov 6, 2025
[AB#3385532](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3385532)

https://identitydivision.visualstudio.com/DevEx/_git/AuthLibrariesApiReview/pullrequest/20357
### Add WebAuthn Version Support and Passkey Headers

This PR adds support for handling the WebAuthn protocol version in the
app configuration and authentication flow for broker-less scenarios.
also enables testing on WEBVIEW PPE MSA

**Changes:**
- Added a new `webauthn_version` field to
`PublicClientApplicationConfiguration`, including serialization,
accessors, and merge logic, allowing apps to define and retrieve the
WebAuthn version from configuration files.
- Updated `CommandParametersAdapter` to include passkey protocol headers
in authentication requests when WebAuthn is enabled, supported (Android
9+), Authorization agent is Webview and the version is 1.1.
- Updated the test app (`MsalWrapper`) to append the `msaoauth2=true`
parameter to query strings when running in the pre-production
environment with WebAuthn 1.1 enabled, enabling proper testing of
WebAuthn flows.

Related PR:
AzureAD/microsoft-authentication-library-common-for-android#2769

Test
1- create account https://signup.live-int.com/?lic=1
2 - Install msal test app, (ensure no broker is installed)
3 - change config to MSA_WEBVIEW_PPE
4- Click acquire token and complete auth flow (username, password)
5 - User is presented with the option to register a passkey, complete
the flow, and you will end up with a token and a passkey.
6 - try again with no user selected and use the passkey.

---------

Co-authored-by: Copilot <[email protected]>
chaoz-MS added a commit to chaoz-MS/microsoft-authentication-library-common-for-android that referenced this pull request Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip-Consumers-Check Only include this if making a breaking change purposefully, and there is an MSAL/ADAL/Broker PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants