Skip to content

Commit 86dda0b

Browse files
committed
added final
1 parent dbe3b21 commit 86dda0b

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

common/src/main/java/com/microsoft/identity/common/internal/ui/webview/AzureActiveDirectoryWebViewClient.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ private boolean shouldLaunchCompanyPortal() {
696696
@VisibleForTesting
697697
protected void loadDeviceCaUrl(@NonNull final String originalUrl, @NonNull final WebView view) {
698698
final String methodTag = TAG + ":loadDeviceCaUrl";
699-
final Span span = createWebCpFlowSpan(SpanName.ProcessWebCpRedirects.name());
699+
final Span span = createSpanWithAttributesFromParent(SpanName.ProcessWebCpRedirects.name());
700700
try (final Scope scope = SpanExtension.makeCurrentSpan(span)) {
701701
if (isWebCpInWebviewFeatureEnabled(originalUrl)) {
702702
Logger.info(methodTag, "Loading device CA request in WebView.");
@@ -741,11 +741,7 @@ protected boolean isWebCpInWebviewFeatureEnabled(@NonNull final String originalU
741741
final int waitForFlightsTimeOut = CommonFlightsManager.INSTANCE.getFlightsProvider().getIntValue(CommonFlight.WEB_CP_WAIT_TIMEOUT_FOR_FLIGHTS);
742742
final boolean isWebCpFlightEnabled = CommonFlightsManager.INSTANCE.getFlightsProviderForTenant(homeTenantId, waitForFlightsTimeOut).isFlightEnabled(CommonFlight.ENABLE_WEB_CP_IN_WEBVIEW);
743743
SpanExtension.current().setAttribute(AttributeName.web_cp_flight_get_time.name(), (System.currentTimeMillis() - webCpGetFlightStartTime));
744-
<<<<<<< HEAD
745-
746-
=======
747744
SpanExtension.current().setAttribute(AttributeName.tenant_id.name(), homeTenantId);
748-
>>>>>>> 37a33baf5 (spans using baggage to get parent's properties)
749745
if (isWebCpFlightEnabled) {
750746
// Directly enabled via flight rollout.
751747
Logger.info(methodTag, "WebCP in WebView feature is enabled.");
@@ -773,7 +769,7 @@ private String getHomeTenantIdFromUrl(@NonNull final String url) {
773769
// This is a special case where the enrollment is not done in the WebView, but rather in the browser.
774770
private void processWebCpEnrollmentUrl(@NonNull final WebView view, @NonNull final String url) {
775771
final String methodTag = TAG + ":processWebCpEnrollmentUrl";
776-
final Span span = createWebCpFlowSpan(SpanName.ProcessWebCpEnrollmentRedirect.name());
772+
final Span span = createSpanWithAttributesFromParent(SpanName.ProcessWebCpEnrollmentRedirect.name());
777773
try (final Scope scope = SpanExtension.makeCurrentSpan(span)) {
778774
view.stopLoading();
779775
Logger.info(methodTag, "Loading WebCP enrollment url in browser.");
@@ -1067,7 +1063,7 @@ private void processNonceAndReAttachHeaders(@NonNull final WebView view, @NonNul
10671063
private void processWebCpAuthorize(@NonNull final WebView view, @NonNull final String url) {
10681064
final String methodTag = TAG + ":processWebCPAuthorize";
10691065
Logger.info(methodTag, "Processing WebCP authorize request.");
1070-
final Span span = createWebCpFlowSpan(SpanName.ProcessWebCpAuthorizeUrlRedirect.name());
1066+
final Span span = createSpanWithAttributesFromParent(SpanName.ProcessWebCpAuthorizeUrlRedirect.name());
10711067
final ReAttachPrtHeaderHandler reAttachPrtHeaderHandler = new ReAttachPrtHeaderHandler(view, mRequestHeaders, span);
10721068
reAttachPrtHeader(url, reAttachPrtHeaderHandler, view, methodTag, span);
10731069
}
@@ -1192,7 +1188,6 @@ public void finalizeBeforeSendingResult(@NonNull final RawAuthorizationResult re
11921188
}
11931189

11941190
/**
1195-
<<<<<<< HEAD
11961191
* Extracts the broker app package name from the given URL.
11971192
* Supports all known broker apps. Returns the first match found.
11981193
* If no known broker app is found, logs a warning and returns an empty string.
@@ -1210,22 +1205,24 @@ private String getBrokerAppPackageNameFromUrl(@NonNull final String url) {
12101205
return "";
12111206
}
12121207

1213-
=======
1214-
* Create a span for webcp flow with parent span context if available.
1208+
/**
1209+
* Create a span with parent span context if available.
12151210
* @param spanName Name of the span to be created.
12161211
* @return Created {@link Span}
12171212
*/
1218-
private Span createWebCpFlowSpan(@NonNull final String spanName) {
1213+
private Span createSpanWithAttributesFromParent(@NonNull final String spanName) {
12191214
final SpanContext spanContext = getActivity() instanceof AuthorizationActivity ? ((AuthorizationActivity) getActivity()).getSpanContext() : null;
12201215
final Span span = spanContext != null ?
12211216
OTelUtility.createSpanFromParent(spanName, spanContext) : OTelUtility.createSpan(spanName);
1222-
// Populate some of parent span's attributes to current span.
1217+
if (mUtid != null) {
1218+
span.setAttribute(AttributeName.tenant_id.name(), mUtid);
1219+
}
1220+
// Populate some of the parent span's attributes to current span.
12231221
final Context oTelContext = getActivity() instanceof AuthorizationActivity ? ((AuthorizationActivity) getActivity()).getOtelContext() : null;
12241222
if (oTelContext != null) {
12251223
final Baggage baggage = BaggageExtension.fromContext(oTelContext);
12261224
final List<AttributeName> parentAttributeNames = Arrays.asList(
12271225
AttributeName.correlation_id,
1228-
AttributeName.tenant_id,
12291226
AttributeName.calling_package_name
12301227
);
12311228
for (AttributeName attributeName : parentAttributeNames) {
@@ -1237,5 +1234,4 @@ private Span createWebCpFlowSpan(@NonNull final String spanName) {
12371234
}
12381235
return span;
12391236
}
1240-
>>>>>>> 37a33baf5 (spans using baggage to get parent's properties)
12411237
}

0 commit comments

Comments
 (0)