Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ internal bool IsCommonOrOrganizationsTenant()

internal static bool IsCommonOrOrganizationsTenant(string tenantId)
{
return !string.IsNullOrEmpty(tenantId) &&
return !string.IsNullOrEmpty(tenantId) &&
!IsConsumers(tenantId) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice investigation in #5184 to find out this regression was introduced by #3517. Strangely, that change in #3517 received an explicit upvote, so, it seemed like an intentional and even desirable removal. I don't remember any context of this change off the top of my head.

s_tenantlessTenantNames.Contains(tenantId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,34 @@ public void IsOrganizationsTenantWithMsaPassthroughEnabled()
Assert.IsTrue(aadAuthorityInstance.IsOrganizationsTenantWithMsaPassthroughEnabled(true, "9188040d-6c67-4c5b-b112-36a304b66dad"));
}

[TestMethod]
public void IsCommonOrOrganizationsTenantTest()
{
//Test for common tenant
AadAuthority aadAuthorityInstance = new AadAuthority(Authority.CreateAuthority("https://login.microsoftonline.com/common").AuthorityInfo);

Assert.IsNotNull(aadAuthorityInstance);
Assert.AreEqual(aadAuthorityInstance.AuthorityInfo.AuthorityType, AuthorityType.Aad);

Assert.IsTrue(aadAuthorityInstance.IsCommonOrOrganizationsTenant());

//Test for common Organizations tenant
aadAuthorityInstance = new AadAuthority(Authority.CreateAuthority("https://login.microsoftonline.com/organizations").AuthorityInfo);

Assert.IsNotNull(aadAuthorityInstance);
Assert.AreEqual(aadAuthorityInstance.AuthorityInfo.AuthorityType, AuthorityType.Aad);

Assert.IsTrue(aadAuthorityInstance.IsCommonOrOrganizationsTenant());

//Test for common Organizations tenant
aadAuthorityInstance = new AadAuthority(Authority.CreateAuthority("https://login.microsoftonline.com/consumers").AuthorityInfo);

Assert.IsNotNull(aadAuthorityInstance);
Assert.AreEqual(aadAuthorityInstance.AuthorityInfo.AuthorityType, AuthorityType.Aad);

Assert.IsFalse(aadAuthorityInstance.IsCommonOrOrganizationsTenant());
}

[TestMethod]
public async Task CreateAuthorityForRequestAsync_MSAPassthroughAsync()
{
Expand Down
Loading