public void TenantlessAuthorityChanges()
        {
            string    commonAuth = TenantlessDstsAuthority + "common/";
            Authority authority  = AuthorityTestHelper.CreateAuthorityFromUrl(
                commonAuth);

            Assert.AreEqual("common", authority.TenantId);
        }
        public void CreateAuthorityFromCommonWithTenantTest()
        {
            Authority authority = AuthorityTestHelper.CreateAuthorityFromUrl("https://login.microsoft.com/common");

            string updatedAuthority = authority.GetTenantedAuthority("other_tenant_id");

            Assert.AreEqual("https://login.microsoft.com/other_tenant_id/", updatedAuthority, "Changed, original is common");

            string updatedAuthority2 = authority.GetTenantedAuthority("other_tenant_id", true);

            Assert.AreEqual("https://login.microsoft.com/other_tenant_id/", updatedAuthority2, "Changed with forced flag");
        }
        public void CreateAuthorityFromTenantedWithTenantTest()
        {
            string    tenantedAuth = TenantlessDstsAuthority + Guid.NewGuid().ToString() + "/";
            Authority authority    = AuthorityTestHelper.CreateAuthorityFromUrl(tenantedAuth);

            string updatedAuthority = authority.GetTenantedAuthority("other_tenant_id");

            Assert.AreEqual(tenantedAuth, updatedAuthority, "Not changed, original authority already has tenant id");

            string updatedAuthority2 = authority.GetTenantedAuthority("other_tenant_id", true);

            Assert.AreEqual("https://foo.bar.test.core.azure-test.net/other_tenant_id/", updatedAuthority2, "Not changed with forced flag");
        }
Beispiel #4
0
        internal static void AuthorityDoesNotUpdateTenant(string authorityUri, string actualTenant)
        {
            Authority authority = AuthorityTestHelper.CreateAuthorityFromUrl(authorityUri);

            Assert.AreEqual(actualTenant, authority.GetTenantId());

            string updatedAuthority = authority.GetTenantedAuthority("other_tenant_id");

            Assert.AreEqual(actualTenant, authority.GetTenantId());
            Assert.AreEqual(updatedAuthority, authorityUri);

            authority.UpdateWithTenant("other_tenant_id_2");
            Assert.AreEqual(authority.AuthorityInfo.CanonicalAuthority, authorityUri);
        }
Beispiel #5
0
        public void TenantlessAuthorityChanges()
        {
            Authority authority = AuthorityTestHelper.CreateAuthorityFromUrl(
                TestConstants.AuthorityCommonTenant);

            Assert.AreEqual("common", authority.GetTenantId());

            string updatedAuthority = authority.GetTenantedAuthority(TestConstants.Utid);

            Assert.AreEqual(TestConstants.AuthorityUtidTenant, updatedAuthority);
            Assert.AreEqual(updatedAuthority, TestConstants.AuthorityUtidTenant);

            authority.UpdateWithTenant(TestConstants.Utid);
            Assert.AreEqual(authority.AuthorityInfo.CanonicalAuthority, TestConstants.AuthorityUtidTenant);
        }