Esempio n. 1
0
        /// <summary>
        /// Ctor. Only call if on Win10, otherwise a TypeLoadException occurs. See DesktopOsHelper.IsWin10
        /// </summary>
        public WamBroker(
            CoreUIParent uiParent,
            ApplicationConfiguration appConfig,
            ICoreLogger logger,
            IWamPlugin testAadPlugin = null,
            IWamPlugin testmsaPlugin = null,
            IWamProxy wamProxy       = null,
            IWebAccountProviderFactory webAccountProviderFactory = null,
            IAccountPickerFactory accountPickerFactory           = null,
            IMsaPassthroughHandler msaPassthroughHandler         = null)
        {
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
            _synchronizationContext = uiParent?.SynchronizationContext;

            _wamProxy     = wamProxy ?? new WamProxy(_logger, _synchronizationContext);
            _parentHandle = GetParentWindow(uiParent);

            _webAccountProviderFactory = webAccountProviderFactory ?? new WebAccountProviderFactory();
            _accountPickerFactory      = accountPickerFactory ?? new AccountPickerFactory();
            _aadPlugin = testAadPlugin ?? new AadPlugin(_wamProxy, _webAccountProviderFactory, _logger);
            _msaPlugin = testmsaPlugin ?? new MsaPlugin(_wamProxy, _webAccountProviderFactory, _logger);

            _msaPassthroughHandler = msaPassthroughHandler ??
                                     new MsaPassthroughHandler(_logger, _msaPlugin, _wamProxy, _parentHandle);

            _wamOptions = appConfig.WindowsBrokerOptions ??
                          WindowsBrokerOptions.CreateDefault();
        }
Esempio n. 2
0
        public void Init()
        {
            _synchronizationContext = new DedicatedThreadSynchronizationContext();

            _coreUIParent = new CoreUIParent()
            {
                SynchronizationContext = _synchronizationContext
            };

            _logger    = Substitute.For <ICoreLogger>();
            _aadPlugin = Substitute.For <IWamPlugin>();
            _msaPlugin = Substitute.For <IWamPlugin>();
            _wamProxy  = Substitute.For <IWamProxy>();
            _webAccountProviderFactory = Substitute.For <IWebAccountProviderFactory>();
            _accountPickerFactory      = Substitute.For <IAccountPickerFactory>();
            _msaPassthroughHandler     = Substitute.For <IMsaPassthroughHandler>();

            _wamBroker = new WamBroker(
                _coreUIParent,
                _logger,
                _aadPlugin,
                _msaPlugin,
                _wamProxy,
                _webAccountProviderFactory,
                _accountPickerFactory,
                _msaPassthroughHandler);
        }