示例#1
0
        public void CanonicalAuthorityInitTest()
        {
            var serviceBundle = TestCommon.CreateDefaultServiceBundle();

            const string UriNoPort          = TestConstants.B2CAuthority;
            const string UriNoPortTailSlash = TestConstants.B2CAuthority;

            const string UriDefaultPort = "https://login.microsoftonline.in:443/tfp/tenant/policy";

            const string UriCustomPort          = "https://login.microsoftonline.in:444/tfp/tenant/policy";
            const string UriCustomPortTailSlash = "https://login.microsoftonline.in:444/tfp/tenant/policy/";
            const string UriVanityPort          = TestConstants.B2CLoginAuthority;

            var authority = new B2CAuthority(serviceBundle, new AuthorityInfo(AuthorityType.B2C, UriNoPort, true));

            Assert.AreEqual(UriNoPortTailSlash, authority.AuthorityInfo.CanonicalAuthority);

            authority = new B2CAuthority(serviceBundle, new AuthorityInfo(AuthorityType.B2C, UriDefaultPort, true));
            Assert.AreEqual(UriNoPortTailSlash, authority.AuthorityInfo.CanonicalAuthority);

            authority = new B2CAuthority(serviceBundle, new AuthorityInfo(AuthorityType.B2C, UriCustomPort, true));
            Assert.AreEqual(UriCustomPortTailSlash, authority.AuthorityInfo.CanonicalAuthority);

            authority = new B2CAuthority(serviceBundle, new AuthorityInfo(AuthorityType.B2C, UriVanityPort, true));
            Assert.AreEqual(UriVanityPort, authority.AuthorityInfo.CanonicalAuthority);
        }
示例#2
0
        public void CanonicalAuthorityInitTest()
        {
            var serviceBundle = ServiceBundle.CreateDefault();

            const string UriNoPort          = CoreTestConstants.B2CAuthority;
            const string UriNoPortTailSlash = CoreTestConstants.B2CAuthority;

            const string UriDefaultPort = "https://login.microsoftonline.in:443/tfp/tenant/policy";

            const string UriCustomPort          = "https://login.microsoftonline.in:444/tfp/tenant/policy";
            const string UriCustomPortTailSlash = "https://login.microsoftonline.in:444/tfp/tenant/policy/";
            const string UriVanityPort          = CoreTestConstants.B2CLoginAuthority;

            var authority = new B2CAuthority(serviceBundle, UriNoPort, false);

            Assert.AreEqual(UriNoPortTailSlash, authority.CanonicalAuthority);

            authority = new B2CAuthority(serviceBundle, UriDefaultPort, false);
            Assert.AreEqual(UriNoPortTailSlash, authority.CanonicalAuthority);

            authority = new B2CAuthority(serviceBundle, UriCustomPort, false);
            Assert.AreEqual(UriCustomPortTailSlash, authority.CanonicalAuthority);

            authority = new B2CAuthority(serviceBundle, UriVanityPort, false);
            Assert.AreEqual(UriVanityPort, authority.CanonicalAuthority);
        }
        /// <summary>
        /// Adds a known authority corresponding to an Azure AD B2C policy.
        /// See https://aka.ms/msal-net-b2c-specificities
        /// </summary>
        /// <param name="authorityUri">Azure AD B2C authority, including the B2C policy (for instance
        /// <c>"https://fabrikamb2c.b2clogin.com/tfp/{Tenant}/{policy}</c></param>)
        /// <returns>The builder to chain the .With methods</returns>
        public T WithB2CAuthority(string authorityUri)
        {
            var authorityInfo = AuthorityInfo.FromB2CAuthority(authorityUri);

            Config.Authority = B2CAuthority.CreateAuthority(authorityInfo);

            return((T)this);
        }
        public void CanonicalAuthorityInitTest()
        {
            const string uriNoPort          = "https://login.microsoftonline.in/tfp/tenant/policy";
            const string uriNoPortTailSlash = "https://login.microsoftonline.in/tfp/tenant/policy/";

            const string uriDefaultPort = "https://login.microsoftonline.in:443/tfp/tenant/policy";

            const string uriCustomPort          = "https://login.microsoftonline.in:444/tfp/tenant/policy";
            const string uriCustomPortTailSlash = "https://login.microsoftonline.in:444/tfp/tenant/policy/";

            var authority = new B2CAuthority(uriNoPort, false);

            Assert.AreEqual(uriNoPortTailSlash, authority.CanonicalAuthority);

            authority = new B2CAuthority(uriDefaultPort, false);
            Assert.AreEqual(uriNoPortTailSlash, authority.CanonicalAuthority);

            authority = new B2CAuthority(uriCustomPort, false);
            Assert.AreEqual(uriCustomPortTailSlash, authority.CanonicalAuthority);
        }
示例#5
0
        public void CanonicalAuthorityInitTest()
        {
            string UriNoPort          = TestConstants.B2CAuthority;
            string UriNoPortTailSlash = TestConstants.B2CAuthority;

            string UriDefaultPort = $"https://login.microsoftonline.in:443/tfp/tenant/{TestConstants.B2CSignUpSignIn}";

            string UriCustomPort          = $"https://login.microsoftonline.in:444/tfp/tenant/{TestConstants.B2CSignUpSignIn}";
            string UriCustomPortTailSlash = $"https://login.microsoftonline.in:444/tfp/tenant/{TestConstants.B2CSignUpSignIn}/";
            string UriVanityPort          = TestConstants.B2CLoginAuthority;

            var authority = new B2CAuthority(new AuthorityInfo(AuthorityType.B2C, UriNoPort, true));

            Assert.AreEqual(UriNoPortTailSlash, authority.AuthorityInfo.CanonicalAuthority);

            authority = new B2CAuthority(new AuthorityInfo(AuthorityType.B2C, UriDefaultPort, true));
            Assert.AreEqual(UriNoPortTailSlash, authority.AuthorityInfo.CanonicalAuthority);

            authority = new B2CAuthority(new AuthorityInfo(AuthorityType.B2C, UriCustomPort, true));
            Assert.AreEqual(UriCustomPortTailSlash, authority.AuthorityInfo.CanonicalAuthority);

            authority = new B2CAuthority(new AuthorityInfo(AuthorityType.B2C, UriVanityPort, true));
            Assert.AreEqual(UriVanityPort, authority.AuthorityInfo.CanonicalAuthority);
        }