public void Init()
        {
            _synchronizationContext = new DedicatedThreadSynchronisationContext();

            _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>();

            _wamBroker = new WamBroker(
                _coreUIParent,
                _logger,
                _aadPlugin,
                _msaPlugin,
                _wamProxy,
                _webAccountProviderFactory,
                _accountPickerFactory);
        }
Beispiel #2
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();
        }
Beispiel #3
0
 public MsaPassthroughHandler(
     ICoreLogger logger,
     IWamPlugin msaPlugin,
     IWamProxy wamProxy,
     IntPtr parentHandle)
 {
     _logger       = logger;
     _msaPlugin    = msaPlugin;
     _wamProxy     = wamProxy;
     _parentHandle = parentHandle;
 }
Beispiel #4
0
        public void Init()
        {
            _logger    = Substitute.For <ICoreLogger>();
            _msaPlugin = Substitute.For <IWamPlugin>();
            _wamProxy  = Substitute.For <IWamProxy>();

            _msaPassthroughHandler = new MsaPassthroughHandler(
                _logger,
                _msaPlugin,
                _wamProxy,
                IntPtr.Zero);
        }
Beispiel #5
0
        public void Init()
        {
            _logger   = Substitute.For <ICoreLogger>();
            _wamProxy = Substitute.For <IWamProxy>();
            _webAccountProviderFactory = Substitute.For <IWebAccountProviderFactory>();
            _accountPickerFactory      = Substitute.For <IAccountPickerFactory>();

            _webAccountProviderFactory.ClearReceivedCalls();
            _cacheSessionManager = Substitute.For <ICacheSessionManager>();

            _instanceDiscoveryManager = Substitute.For <IInstanceDiscoveryManager>();

            _aadPlugin = new AadPlugin(_wamProxy, _webAccountProviderFactory, _logger);
        }
Beispiel #6
0
        public WamBroker(
            CoreUIParent uiParent,
            ICoreLogger logger,
            IWamPlugin testAadPlugin = null,
            IWamPlugin testmsaPlugin = null,
            IWamProxy wamProxy       = null,
            IWebAccountProviderFactory webAccountProviderFactory = null,
            IAccountPickerFactory accountPickerFactory           = null)
        {
            _logger                 = logger ?? throw new ArgumentNullException(nameof(logger));
            _wamProxy               = wamProxy ?? new WamProxy(_logger);
            _parentHandle           = GetParentWindow(uiParent);
            _synchronizationContext = uiParent?.SynchronizationContext;

            _webAccountProviderFactory = webAccountProviderFactory ?? new WebAccountProviderFactory();
            _accountPickerFactory      = accountPickerFactory ?? new AccountPickerFactory();
            _aadPlugin = testAadPlugin ?? new AadPlugin(_wamProxy, _webAccountProviderFactory, _logger);
            _msaPlugin = testmsaPlugin ?? new MsaPlugin(_wamProxy, _webAccountProviderFactory, _logger);
        }
Beispiel #7
0
 public MsaPlugin(IWamProxy wamProxy, IWebAccountProviderFactory webAccountProviderFactory, ICoreLogger logger)
 {
     _wamProxy = wamProxy;
     _webAccountProviderFactory = webAccountProviderFactory;
     _logger = logger;
 }