-
Notifications
You must be signed in to change notification settings - Fork 47
Add SpanContext support to PasskeyWebListener and WebViewAuthorizationFragment, Fixes AB#3470497 #2850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Add SpanContext support to PasskeyWebListener and WebViewAuthorizationFragment, Fixes AB#3470497 #2850
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
79cd570
Add SpanContext support to PasskeyWebListener and WebViewAuthorizatio…
p3dr0rv c4fe69f
Add SpanContext support to PasskeyWebListener and WebViewAuthorizatio…
p3dr0rv 5475353
kdoc
p3dr0rv a578feb
Make spanContext parameter optional in PasskeyWebListener and update …
p3dr0rv e465deb
Fix spanContext retrieval in WebViewAuthorizationFragment to use requ…
p3dr0rv 590c850
Merge branch 'dev' into pedroro/passkey-spancontext
p3dr0rv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,7 @@ import com.microsoft.identity.common.BuildConfig | |
| import com.microsoft.identity.common.internal.ui.webview.AzureActiveDirectoryWebViewClient | ||
| import com.microsoft.identity.common.java.exception.ClientException | ||
| import com.microsoft.identity.common.logging.Logger | ||
| import io.opentelemetry.api.trace.SpanContext | ||
| import kotlinx.coroutines.CoroutineScope | ||
| import kotlinx.coroutines.Dispatchers | ||
| import kotlinx.coroutines.launch | ||
|
|
@@ -55,6 +56,7 @@ import java.util.concurrent.atomic.AtomicBoolean | |
| class PasskeyWebListener( | ||
| private val coroutineScope: CoroutineScope, | ||
| private val credentialManagerHandler: CredentialManagerHandler, | ||
| private val spanContext: SpanContext? | ||
| ) : WebViewCompat.WebMessageListener { | ||
|
|
||
| /** Tracks if a WebAuthN request is currently pending. Only one request is allowed at a time. */ | ||
|
|
@@ -106,7 +108,11 @@ class PasskeyWebListener( | |
| methodTag, | ||
| "Received WebAuthN request of type: ${webAuthNMessage.type} from origin: $sourceOrigin" | ||
| ) | ||
| val passkeyReplyChannel = PasskeyReplyChannel(javaScriptReplyProxy, webAuthNMessage.type) | ||
| val passkeyReplyChannel = PasskeyReplyChannel( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is spanContext then being used to parent the new span? |
||
| replyProxy = javaScriptReplyProxy, | ||
| requestType = webAuthNMessage.type, | ||
| spanContext = spanContext | ||
| ) | ||
|
|
||
| // Only allow one request at a time. | ||
| if (havePendingRequest.get()) { | ||
|
|
@@ -228,7 +234,10 @@ class PasskeyWebListener( | |
| messageData: String?, | ||
| javaScriptReplyProxy: JavaScriptReplyProxy | ||
| ): WebAuthNMessage? { | ||
| val passkeyReplyChannel = PasskeyReplyChannel(javaScriptReplyProxy) | ||
| val passkeyReplyChannel = PasskeyReplyChannel( | ||
| replyProxy = javaScriptReplyProxy, | ||
| spanContext = spanContext | ||
| ) | ||
| return runCatching { | ||
| if (messageData.isNullOrBlank()) { | ||
| throw ClientException(ClientException.MISSING_PARAMETER, "Message data is null or blank") | ||
|
|
@@ -306,7 +315,8 @@ class PasskeyWebListener( | |
| fun hook( | ||
| webView: WebView, | ||
| activity: Activity, | ||
| webClient: AzureActiveDirectoryWebViewClient | ||
| webClient: AzureActiveDirectoryWebViewClient, | ||
| spanContext: SpanContext? | ||
p3dr0rv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ): Boolean { | ||
| val methodTag = "$TAG:hook" | ||
|
|
||
|
|
@@ -330,7 +340,8 @@ class PasskeyWebListener( | |
| PasskeyOriginRulesManager.getAllowedOriginRules(), | ||
| PasskeyWebListener( | ||
| coroutineScope = CoroutineScope(Dispatchers.Default), | ||
| credentialManagerHandler = CredentialManagerHandler(activity) | ||
| credentialManagerHandler = CredentialManagerHandler(activity), | ||
| spanContext = spanContext | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.