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");
        }
Exemplo n.º 4
0
        public void TenantTest()
        {
            AuthorityTestHelper.AuthorityDoesNotUpdateTenant(
                "https://sometenantid.b2clogin.com/tfp/sometenantid/policy/",
                "sometenantid");

            AuthorityTestHelper.AuthorityDoesNotUpdateTenant(
                "https://catsareamazing.com/tfp/catsareamazing/policy/",
                "catsareamazing");

            AuthorityTestHelper.AuthorityDoesNotUpdateTenant(
                "https://sometenantid.b2clogin.de/tfp/tid/policy/",
                "tid");
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
 public void TenantAuthorityDoesNotChange()
 {
     // no change because initial authority is tenanted
     AuthorityTestHelper.AuthorityDoesNotUpdateTenant(
         TestConstants.AuthorityUtidTenant, TestConstants.Utid);
 }
Exemplo n.º 8
0
 public void TenantTest()
 {
     AuthorityTestHelper.AuthorityDoesNotUpdateTenant(
         TestConstants.ADFSAuthority, null);
 }