public void IsBrokerAvailable_net5()
        {
            var appBuilder = PublicClientApplicationBuilder
                             .Create(TestConstants.ClientId);

            Assert.AreEqual(DesktopOsHelper.IsWin10OrServerEquivalent(), appBuilder.IsBrokerAvailable());
        }
        public void WamOnWin10()
        {
            if (!DesktopOsHelper.IsWin10OrServerEquivalent())
            {
                Assert.Inconclusive("Needs to run on win10 or equivalent");
            }
            var pcaBuilder = PublicClientApplicationBuilder
                             .Create("d3adb33f-c0de-ed0c-c0de-deadb33fc0d3")
                             .WithAuthority(TestConstants.AuthorityTenant);

            pcaBuilder = pcaBuilder.WithBrokerPreview();
            Assert.IsTrue(pcaBuilder.IsBrokerAvailable());
        }
Beispiel #3
0
 public override IBroker CreateBroker(ApplicationConfiguration appConfig, CoreUIParent uiParent)
 {
     if (DesktopOsHelper.IsWin10OrServerEquivalent())
     {
         return(appConfig.BrokerCreatorFunc != null?
                appConfig.BrokerCreatorFunc(uiParent, appConfig, Logger) :
                    new Features.WamBroker.WamBroker(uiParent, appConfig, Logger));
     }
     else
     {
         Logger.Info("Not a Win10 machine. WAM is not available");
         return(new NullBroker());
     }
 }
        public override IBroker CreateBroker(ApplicationConfiguration appConfig, CoreUIParent uiParent)
        {
            if (DesktopOsHelper.IsWin10OrServerEquivalent())
            {
                Logger.Info("WAM supported OS. ");

                return(appConfig.BrokerCreatorFunc != null?
                       appConfig.BrokerCreatorFunc(uiParent, appConfig, Logger) :
                           new Features.WamBroker.WamBroker(uiParent, appConfig, Logger));
            }
            else
            {
                Logger.Info("WAM is not available. WAM is supported only on Windows 10+ or Windows Server 2019+");
                return(new NullBroker(Logger));
            }
        }
Beispiel #5
0
 internal static void AddSupportForWam(PublicClientApplicationBuilder builder)
 {
     if (DesktopOsHelper.IsWin10OrServerEquivalent())
     {
         builder.Config.BrokerCreatorFunc =
             (uiParent, appConfig, logger) => new Platforms.Features.WamBroker.WamBroker(uiParent, appConfig, logger);
     }
     else
     {
         builder.Config.BrokerCreatorFunc =
             (uiParent, appConfig, logger) =>
         {
             logger.Info("Not a Win10 machine. WAM is not available");
             return(new NullBroker());
         };
     }
 }
        public void IsBrokerAvailable_OldDotNet()
        {
            var builder1 = PublicClientApplicationBuilder
                           .Create(TestConstants.ClientId);


            // broker is not available out of the box
            Assert.AreEqual(false, builder1.IsBrokerAvailable());

            var builder2 = PublicClientApplicationBuilder
                           .Create(TestConstants.ClientId)
                           .WithDesktopFeatures();


            // broker is not available out of the box
            Assert.AreEqual(DesktopOsHelper.IsWin10OrServerEquivalent(), builder2.IsBrokerAvailable());
        }
        public bool IsBrokerInstalledAndInvokable(AuthorityType authorityType)
        {
            if (!DesktopOsHelper.IsWin10OrServerEquivalent())
            {
                _logger.Warning("[WAM Broker] Not a supported operating system. WAM broker is not available. ");
                return(false);
            }

            // WAM does not work on pure ADFS environments
            if (authorityType == AuthorityType.Adfs)
            {
                _logger.Warning("[WAM Broker] WAM does not work in pure ADFS environments. Falling back to browser for an ADFS authority. ");
                return(false);
            }

            _logger.Verbose("[WAM Broker] IsBrokerInstalledAndInvokable true");
            return(true);
        }
 private static void AddRuntimeSupportForWam(PublicClientApplicationBuilder builder)
 {
     if (DesktopOsHelper.IsWin10OrServerEquivalent())
     {
         builder.Config.BrokerCreatorFunc =
             (uiParent, appConfig, logger) =>
         {
             logger.Info("WAM supported OS.");
             return(new RuntimeBroker(uiParent, appConfig, logger));
         };
     }
     else
     {
         builder.Config.BrokerCreatorFunc =
             (uiParent, appConfig, logger) =>
         {
             logger.Info("Not a Win10 machine. WAM is not available");
             return(new NullBroker(logger));
         };
     }
 }