From 255bda208663eee154b669e48bee6e6ef455cfc4 Mon Sep 17 00:00:00 2001 From: Brett White Date: Wed, 6 Nov 2024 17:06:02 -0800 Subject: [PATCH] Add AppHomeTenantId to MicrosoftIdentityApplicationOptions --- .../MicrosoftIdentityApplicationOptions.cs | 5 +++++ .../PublicAPI/net462/PublicAPI.Unshipped.txt | 2 ++ .../PublicAPI/net8.0/PublicAPI.Unshipped.txt | 2 ++ .../PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt | 2 ++ .../PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt | 2 ++ .../MicrosoftIdentityApplicationOptionsTests.cs | 3 +++ 6 files changed, 16 insertions(+) diff --git a/src/Microsoft.Identity.Abstractions/ApplicationOptions/MicrosoftIdentityApplicationOptions.cs b/src/Microsoft.Identity.Abstractions/ApplicationOptions/MicrosoftIdentityApplicationOptions.cs index d4d3b1b..4661e42 100644 --- a/src/Microsoft.Identity.Abstractions/ApplicationOptions/MicrosoftIdentityApplicationOptions.cs +++ b/src/Microsoft.Identity.Abstractions/ApplicationOptions/MicrosoftIdentityApplicationOptions.cs @@ -38,6 +38,11 @@ public override string? Authority } #region Token acquisition + /// + /// Home tenant of the app in which the app can acquire a token to call a downstream API on behalf of itself. + /// + public string? AppHomeTenantId { get; set; } + /// /// Specifies the Azure region. See https://aka.ms/azure-region. To have /// the app attempt to detect the Azure region automatically, diff --git a/src/Microsoft.Identity.Abstractions/PublicAPI/net462/PublicAPI.Unshipped.txt b/src/Microsoft.Identity.Abstractions/PublicAPI/net462/PublicAPI.Unshipped.txt index 7dc5c58..06365be 100644 --- a/src/Microsoft.Identity.Abstractions/PublicAPI/net462/PublicAPI.Unshipped.txt +++ b/src/Microsoft.Identity.Abstractions/PublicAPI/net462/PublicAPI.Unshipped.txt @@ -1 +1,3 @@ #nullable enable +Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.get -> string? +Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.set -> void diff --git a/src/Microsoft.Identity.Abstractions/PublicAPI/net8.0/PublicAPI.Unshipped.txt b/src/Microsoft.Identity.Abstractions/PublicAPI/net8.0/PublicAPI.Unshipped.txt index 7dc5c58..06365be 100644 --- a/src/Microsoft.Identity.Abstractions/PublicAPI/net8.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.Identity.Abstractions/PublicAPI/net8.0/PublicAPI.Unshipped.txt @@ -1 +1,3 @@ #nullable enable +Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.get -> string? +Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.set -> void diff --git a/src/Microsoft.Identity.Abstractions/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/Microsoft.Identity.Abstractions/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index 7dc5c58..06365be 100644 --- a/src/Microsoft.Identity.Abstractions/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.Identity.Abstractions/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -1 +1,3 @@ #nullable enable +Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.get -> string? +Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.set -> void diff --git a/src/Microsoft.Identity.Abstractions/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt b/src/Microsoft.Identity.Abstractions/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt index 7dc5c58..06365be 100644 --- a/src/Microsoft.Identity.Abstractions/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt +++ b/src/Microsoft.Identity.Abstractions/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt @@ -1 +1,3 @@ #nullable enable +Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.get -> string? +Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.set -> void diff --git a/test/Microsoft.Identity.Abstractions.Tests/MicrosoftIdentityApplicationOptionsTests.cs b/test/Microsoft.Identity.Abstractions.Tests/MicrosoftIdentityApplicationOptionsTests.cs index 2fc8718..b8f6c3f 100644 --- a/test/Microsoft.Identity.Abstractions.Tests/MicrosoftIdentityApplicationOptionsTests.cs +++ b/test/Microsoft.Identity.Abstractions.Tests/MicrosoftIdentityApplicationOptionsTests.cs @@ -19,6 +19,7 @@ public class MicrosoftIdentityApplicationOptionsTests private CredentialDescription secret = new() { SourceType = CredentialSource.ClientSecret, ClientSecret = "blah" }; private CredentialDescription decryptCert = new CredentialDescription { SourceType = CredentialSource.Base64Encoded, Base64EncodedValue = "0123" }; private string[] audiences = new[] { "https://myapi", clientId }; + private const string appHomeTenantId = "this-is-a-tenant-guid"; [Fact] public void MicrosoftIdentityApplicationOptionsProperties() @@ -27,6 +28,7 @@ public void MicrosoftIdentityApplicationOptionsProperties() { Instance = instance, TenantId = tenant, + AppHomeTenantId = appHomeTenantId, ClientId = clientId, Audience = audience, AzureRegion = azureRegion, @@ -59,6 +61,7 @@ public void MicrosoftIdentityApplicationOptionsProperties() Assert.Equal("https://login.microsoftonline.com/common", microsoftIdentityApplicationOptions.Authority); Assert.Equal(clientId, microsoftIdentityApplicationOptions.ClientId); Assert.Equal(tenant, microsoftIdentityApplicationOptions.TenantId); + Assert.Equal(appHomeTenantId, microsoftIdentityApplicationOptions.AppHomeTenantId); Assert.Equal(clientId, microsoftIdentityApplicationOptions.Audience); Assert.Equal(clientCapabilities, microsoftIdentityApplicationOptions.ClientCapabilities); Assert.Equal(azureRegion, microsoftIdentityApplicationOptions.AzureRegion);