-
Couldn't load subscription status.
- Fork 46
Add Audience as span attribute for AAD/MSA/Common, Fixes #2970888 #2495
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
Changes from 3 commits
cd68cf6
fbe8a84
7453c3b
7590468
eb048b0
a8096e5
10ef5ec
dc40771
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,6 +53,16 @@ public abstract class AzureActiveDirectoryAudience { | |
| public static final String ALL = "common"; | ||
| public static final String MSA_MEGA_TENANT_ID = "9188040d-6c67-4c5b-b112-36a304b66dad"; | ||
|
|
||
| // The values here are audience values reported in telemetry | ||
| // rather than the values used to send to eSTS. | ||
| public static class TelemetryConstants { | ||
| public static final String MSA_AUDIENCE_FOR_REPORTING = "MSA"; | ||
| public static final String COMMON_AUDIENCE_FOR_REPORTING = "COMMON"; | ||
| public static final String AAD_AUDIENCE_FOR_REPORTING = "AAD"; | ||
| public static final String UNKNOWN_AUDIENCE_FOR_REPORTING = "UNKNOWN"; | ||
| } | ||
|
||
|
|
||
|
|
||
| public String getCloudUrl() { | ||
| if (mCloudUrl == null) { | ||
| return AzureActiveDirectory.getDefaultCloudUrl(); | ||
|
|
@@ -154,6 +164,32 @@ public void setTenantId(String tenantId) { | |
| mTenantId = tenantId; | ||
| } | ||
|
|
||
| /** | ||
| * Determines the audience type (MSA, Common, AAD, or Unknown) from the given | ||
| * {@link AzureActiveDirectoryAuthority}. | ||
| * | ||
| * @param authority The authority from which the audience is derived. | ||
| * @return The audience type: "MSA", "Common", "AAD", or "Unknown". | ||
| */ | ||
| public static String getAudienceFromAuthority( final AzureActiveDirectoryAuthority authority) { | ||
tanmaymanolkar1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
tanmaymanolkar1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
tanmaymanolkar1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if (authority == null || StringUtil.isNullOrEmpty(authority.getAudience().getTenantId())) { | ||
tanmaymanolkar1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return TelemetryConstants.UNKNOWN_AUDIENCE_FOR_REPORTING; | ||
| } | ||
|
|
||
| final String audienceToCheck = authority.getAudience().mTenantId.toLowerCase(Locale.ROOT); | ||
tanmaymanolkar1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
tanmaymanolkar1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if (audienceToCheck.equals(CONSUMERS) || audienceToCheck.equals(MSA_MEGA_TENANT_ID)) { | ||
| return TelemetryConstants.MSA_AUDIENCE_FOR_REPORTING; | ||
| } | ||
| else if (audienceToCheck.equals(ALL)) { | ||
| return TelemetryConstants.COMMON_AUDIENCE_FOR_REPORTING; | ||
| } | ||
| else { | ||
| return TelemetryConstants.AAD_AUDIENCE_FOR_REPORTING; | ||
tanmaymanolkar1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| public static AzureActiveDirectoryAudience getAzureActiveDirectoryAudience(final String cloudUrl, | ||
| final String tenantId) { | ||
| final String methodName = ":getAzureActiveDirectoryAudience"; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.