Skip to content

Commit

Permalink
Add AppHomeTenantId to MicrosoftIdentityApplicationOptions (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
msbw2 authored Nov 7, 2024
1 parent b92053d commit bd4ab18
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public override string? Authority
}

#region Token acquisition
/// <summary>
/// Home tenant of the app in which the app can acquire a token to call a downstream API on behalf of itself.
/// </summary>
public string? AppHomeTenantId { get; set; }

/// <summary>
/// Specifies the Azure region. See https://aka.ms/azure-region. To have
/// the app attempt to detect the Azure region automatically,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#nullable enable
Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.get -> string?
Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.set -> void
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#nullable enable
Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.get -> string?
Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.set -> void
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#nullable enable
Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.get -> string?
Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.set -> void
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#nullable enable
Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.get -> string?
Microsoft.Identity.Abstractions.MicrosoftIdentityApplicationOptions.AppHomeTenantId.set -> void
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -27,6 +28,7 @@ public void MicrosoftIdentityApplicationOptionsProperties()
{
Instance = instance,
TenantId = tenant,
AppHomeTenantId = appHomeTenantId,
ClientId = clientId,
Audience = audience,
AzureRegion = azureRegion,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bd4ab18

Please sign in to comment.