public static MockWebUI ConfigureMockWebUI(
     IPlatformProxy platformProxy,
     AuthorizationResult authorizationResult,
     Dictionary <string, string> queryParamsToValidate)
 {
     return(ConfigureMockWebUI(platformProxy, authorizationResult, queryParamsToValidate, null));
 }
Пример #2
0
 public void TestInitialize()
 {
     TestCommon.ResetInternalStaticCaches();
     _tcpInterceptor = Substitute.For <ITcpInterceptor>();
     _platformProxy  = Substitute.For <IPlatformProxy>();
     _logger         = Substitute.For <ICoreLogger>();
 }
Пример #3
0
 public LoginController(IPlatformProxy platformProxy,IPlatformRoutes platformRoutes,IApplicationSettings applicationSettings, IAppWallServices appWallServices)
 {
     _platformProxy = platformProxy;
     _platformRoutes = platformRoutes;
     _applicationSettings = applicationSettings;
     _appWallServices = appWallServices;
 }
        public static void ConfigureMockWebUI(IPlatformProxy platformProxy, IWebUI webUi = null)
        {
            IWebUIFactory mockFactory = Substitute.For <IWebUIFactory>();

            mockFactory.CreateAuthenticationDialog(Arg.Any <CoreUIParent>(), Arg.Any <RequestContext>()).Returns(webUi);
            platformProxy.SetWebUiFactory(mockFactory);
        }
Пример #5
0
 public override void TestInitialize()
 {
     base.TestInitialize();
     _tcpInterceptor = Substitute.For <IUriInterceptor>();
     _platformProxy  = Substitute.For <IPlatformProxy>();
     _logger         = Substitute.For <ICoreLogger>();
 }
Пример #6
0
 public LandingController(IPlatformProxy platformProxy, IBoardsRepository boardsRepository, IPlatformSettings platformSettings, IApplicationSettings applicationSettings)
 {
     _platformProxy = platformProxy;
     _boardsRepository = boardsRepository;
     _platformSettings = platformSettings;
     _applicationSettings = applicationSettings;
 }
Пример #7
0
 public void Initialize()
 {
     TestCommon.ResetInternalStaticCaches();
     _serviceBundle = TestCommon.CreateServiceBundleWithCustomHttpManager(null, clientId: ClientId);
     _logger        = _serviceBundle.ApplicationLogger;
     _platformProxy = _serviceBundle.PlatformProxy;
     _crypto        = _platformProxy.CryptographyManager;
 }
Пример #8
0
 public HomeController(IPlatformProxy platformProxy, IPlatformSettings platformSettings, IImageService imageService, IBoardsRepository boardsRepository, IBoardItemsRepository boardItemsRepository)
 {
     _platformProxy = platformProxy;
     _platformSettings = platformSettings;
     _imageService = imageService;
     _boardsRepository = boardsRepository;
     _boardItemsRepository = boardItemsRepository;
 }
Пример #9
0
 public AppLinksService(IPlatformProxy platformProxy, IApplicationSettings applicationSettings, IHashService hashService, IEntitiesRepository entitiesRepository, ILog log)
 {
     _platformProxy = platformProxy;
     _applicationSettings = applicationSettings;
     _hashService = hashService;
     _entitiesRepository = entitiesRepository;
     _log = log;
     _servicePath = _applicationSettings.AppLinkPath;
 }
Пример #10
0
 public AppLinksService(IPlatformProxy platformProxy, IApplicationSettings applicationSettings, IHashService hashService, IEntitiesRepository entitiesRepository, ILog log)
 {
     _platformProxy       = platformProxy;
     _applicationSettings = applicationSettings;
     _hashService         = hashService;
     _entitiesRepository  = entitiesRepository;
     _log         = log;
     _servicePath = _applicationSettings.AppLinkPath;
 }
Пример #11
0
        public static string GetUploadEventName(IPlatformProxy platformProxy, EventType eventType, string appName)
        {
            string eventName  = MatsConverter.AsString(eventType);
            string osPlatform = platformProxy.GetMatsOsPlatform();

            return(GetUploadEventNameGeneric(
                       eventName.ToUpperInvariant(),
                       appName.ToUpperInvariant(),
                       osPlatform.ToUpperInvariant()));
        }
Пример #12
0
        public UserService(IPlatformProxy platformProxy, IApplicationSettings applicationSettings, IAuthService authService, IHashService hashService, ILog logger)
        {
            _platformProxy       = platformProxy;
            _applicationSettings = applicationSettings;
            _authService         = authService;
            _hashService         = hashService;
            _logger = logger;

            _servicePath = _applicationSettings.UsersPath;
        }
        public DefaultOsBrowserWebUi(
            IPlatformProxy proxy,
            ICoreLogger logger,
            /* for test */ ITcpInterceptor tcpInterceptor = null)
        {
            _logger        = logger ?? throw new ArgumentNullException(nameof(logger));
            _platformProxy = proxy ?? throw new ArgumentNullException(nameof(proxy));

            _tcpInterceptor = tcpInterceptor ?? new TcpInterceptor(_logger);
        }
 public void Initialize()
 {
     TestCommon.ResetInternalStaticCaches();
     _myReceiver       = new MyReceiver();
     _serviceBundle    = TestCommon.CreateServiceBundleWithCustomHttpManager(null, clientId: ClientId);
     _logger           = _serviceBundle.DefaultLogger;
     _platformProxy    = _serviceBundle.PlatformProxy;
     _crypto           = _platformProxy.CryptographyManager;
     _telemetryManager = new TelemetryManager(_serviceBundle.Config, _platformProxy, _myReceiver.HandleTelemetryEvents);
 }
 public PostLoginController(IPlatformProxy platformProxy, IApplicationSettings applicationSettings, IPlatformTokenProvider platformTokenProvider,
      IPlatformSettings platformSettings, IPlatformRoutes platformRoutes, IUsersApi usersApi, IGroupMemberRepository groupMemberRepository)
 {
     _platformTokenProvider = platformTokenProvider;
     _platformProxy = platformProxy;
     _applicationSettings = applicationSettings;
     _platformSettings = platformSettings;
     _platformRoutes = platformRoutes;
     _usersApi = usersApi;
     _groupMemberRepository = groupMemberRepository;
 }
 public TelemetryManager(
     ApplicationConfiguration applicationConfiguration,
     IPlatformProxy platformProxy,
     TelemetryCallback telemetryCallback,
     bool onlySendFailureTelemetry = false)
 {
     _applicationConfiguration = applicationConfiguration;
     _platformProxy            = platformProxy;
     Callback = telemetryCallback;
     _onlySendFailureTelemetry = onlySendFailureTelemetry;
 }
        public DefaultOsBrowserWebUi(
            IPlatformProxy proxy,
            ICoreLogger logger,
            SystemWebViewOptions webViewOptions,
            /* for test */ IUriInterceptor uriInterceptor = null)
        {
            _logger         = logger ?? throw new ArgumentNullException(nameof(logger));
            _webViewOptions = webViewOptions;
            _platformProxy  = proxy ?? throw new ArgumentNullException(nameof(proxy));

            _uriInterceptor = uriInterceptor ?? new HttpListenerInterceptor(_logger);
        }
Пример #18
0
 public TelemetryManager(
     IApplicationConfiguration applicationConfiguration,
     IPlatformProxy platformProxy,
     TelemetryCallback telemetryCallback,
     bool onlySendFailureTelemetry = false)
 {
     _mostRecentStoppedApiEvent = null;
     _applicationConfiguration  = applicationConfiguration;
     _platformProxy             = platformProxy;
     Callback = telemetryCallback;
     _onlySendFailureTelemetry = onlySendFailureTelemetry;
 }
 public DefaultEvent(IPlatformProxy platformProxy, string correlationId, string clientId, IDictionary <string, int> eventCount)
     : base(EventNamePrefix + "default_event", correlationId)
 {
     this[EventNamePrefix + "client_id"]           = clientId;
     this[EventNamePrefix + "sdk_platform"]        = platformProxy.GetProductName()?.ToLowerInvariant();
     this[EventNamePrefix + "sdk_version"]         = MsalIdHelper.GetMsalVersion();
     this[EventNamePrefix + "application_name"]    = HashPersonalIdentifier(platformProxy.CryptographyManager, platformProxy.GetCallingApplicationName()?.ToLowerInvariant());
     this[EventNamePrefix + "application_version"] = HashPersonalIdentifier(platformProxy.CryptographyManager, platformProxy.GetCallingApplicationVersion()?.ToLowerInvariant());
     this[EventNamePrefix + "device_id"]           = HashPersonalIdentifier(platformProxy.CryptographyManager, platformProxy.GetDeviceId()?.ToLowerInvariant());
     this[MsalTelemetryBlobEventNames.UiEventCountTelemetryBatchKey]   = GetEventCount(EventNamePrefix + "ui_event", eventCount);
     this[MsalTelemetryBlobEventNames.HttpEventCountTelemetryBatchKey] = GetEventCount(EventNamePrefix + "http_event", eventCount);
     this[MsalTelemetryBlobEventNames.CacheEventCountConstStrKey]      = GetEventCount(EventNamePrefix + "cache_event", eventCount);
 }
Пример #20
0
        public static T WithCachePartitioningAsserts <T>(
            this AbstractApplicationBuilder <T> builder,
            IPlatformProxy platformProxy)
            where T : AbstractApplicationBuilder <T>
        {
            (platformProxy as AbstractPlatformProxy).UserTokenCacheAccessorForTest =
                new UserAccessorWithPartitionAsserts(new NullLogger(), null);

            (platformProxy as AbstractPlatformProxy).AppTokenCacheAccessorForTest =
                new AppAccessorWithPartitionAsserts(new NullLogger(), null);

            builder.Config.PlatformProxy = platformProxy;
            return((T)builder);
        }
Пример #21
0
        public static void ConfigureMockWebUI(
            IPlatformProxy platformProxy,
            AuthorizationResult authorizationResult,
            Dictionary <string, string> queryParamsToValidate,
            string environment)
        {
            MockWebUI webUi = new MockWebUI
            {
                QueryParamsToValidate = queryParamsToValidate,
                MockResult            = authorizationResult,
                ExpectedEnvironment   = environment
            };

            ConfigureMockWebUI(platformProxy, webUi);
        }
Пример #22
0
        public void SendTrackInformationIsBeingSent()
        {
            IPlatformProxy proxy = IntegrationProxy.GetInstance(new IntegrationProxyArgs.IntegrationProxyArgsBuilder().BuildDefault()).Proxy;

            var input = new OrderTrackingInformation()
            {
                Order_id = 12,
                Event    = new OrderTrackingEvent()
                {
                    Date      = DateTime.Now,
                    Status_id = 1
                }
            };

            Assert.True(proxy.SendTrackNotification(input).IsSuccess);
        }
Пример #23
0
        internal PublicClientApplication(
            IHttpManager httpManager,
            IStorageManager storageManager,
            IBrowserFactory browserFactory,
            IGuidService guidService,
            ITelemetryManager telemetryManager,
            EnvironmentMetadata environmentMetadata,
            MsalClientConfiguration msalClientConfiguration)
        {
            _platformProxy = PlatformProxyFactory.GetPlatformProxy();

            _httpManager             = httpManager ?? new HttpManager(new HttpClientFactory(), msalClientConfiguration);
            _storageManager          = storageManager ?? _platformProxy.CreateStorageManager();
            _browserFactory          = browserFactory ?? _platformProxy.CreateBrowserFactory();
            _guidService             = guidService ?? new GuidService();
            _telemetryManager        = telemetryManager ?? new TelemetryManager(msalClientConfiguration);
            _environmentMetadata     = environmentMetadata ?? new EnvironmentMetadata();
            _msalClientConfiguration = msalClientConfiguration;
        }
        private TelemetryClient(
            IApplicationConfiguration applicationConfiguration,
            IPlatformProxy platformProxy,
            IErrorStore errorStore,
            IUploader uploader,
            IActionStore actionStore,
            IScenarioStore scenarioStore,
            ContextStore contextStore,
            bool isScenarioUploadDisabled)
        {
            TelemetryManager = new TelemetryManager(applicationConfiguration, platformProxy, ProcessTelemetryCallback);

            _errorStore               = errorStore;
            _uploader                 = uploader;
            _actionStore              = actionStore;
            _scenarioStore            = scenarioStore;
            _contextStore             = contextStore;
            _isScenarioUploadDisabled = isScenarioUploadDisabled;
        }
Пример #25
0
 public ApiNewsfeedService(IPlatformProxy platformProxy)
 {
     _platformProxy = platformProxy;
 }
        public static ITelemetryClient CreateMats(
            IApplicationConfiguration applicationConfiguration,
            IPlatformProxy platformProxy,
            ITelemetryConfig telemetryConfig)
        {
            string dpti = platformProxy.GetDevicePlatformTelemetryId();

            if (!IsDeviceEnabled(telemetryConfig.AudienceType, dpti))
            {
                return(null);
            }

            string deviceNetworkState = platformProxy.GetDeviceNetworkState();
            int    osPlatformCode     = platformProxy.GetMatsOsPlatformCode();

            bool         enableAggregation = true;
            IEventFilter eventFilter       = new EventFilter(enableAggregation);
            var          errorStore        = new ErrorStore();
            var          scenarioStore     = new ScenarioStore(TimeConstants.ScenarioTimeoutMilliseconds, errorStore);

            var allowedScopes = new HashSet <string>();

            // TODO: need to determine what MATS was doing with the AllowedScopes and DeniedScopes values in the C++ impl
            // and possibly expose this value in the ITelemetryConfig interface.
            //if (telemetryConfig.AllowedScopes != null)
            //{
            //    foreach (string s in telemetryConfig.AllowedScopes)
            //    {
            //        allowedScopes.Add(s);
            //    }
            //}

            var actionStore = new ActionStore(
                TimeConstants.ActionTimeoutMilliseconds,
                TimeConstants.AggregationWindowMilliseconds,
                errorStore,
                eventFilter,
                allowedScopes);

            var contextStore = ContextStore.CreateContextStore(
                telemetryConfig.AudienceType,
                applicationConfiguration.ClientName,
                applicationConfiguration.ClientVersion,
                dpti,
                deviceNetworkState,
                telemetryConfig.SessionId,
                osPlatformCode);

            IUploader uploader = new TelemetryUploader(telemetryConfig.DispatchAction, platformProxy, applicationConfiguration.ClientName);

            // it's this way in mats c++
            bool isScenarioUploadDisabled = true;

            return(new TelemetryClient(
                       applicationConfiguration,
                       platformProxy,
                       errorStore,
                       uploader,
                       actionStore,
                       scenarioStore,
                       contextStore,
                       isScenarioUploadDisabled));
        }
Пример #27
0
 public ApiUsersService(IPlatformProxy platformProxy)
 {
     _platformProxy = platformProxy;
 }
Пример #28
0
 public LandingController(IPlatformProxy platformProxy,IPlatformRoutes platformRoutes)
 {
     _platformProxy = platformProxy;
     _platformRoutes = platformRoutes;
 }
 public static MockWebUI ConfigureMockWebUI(IPlatformProxy platformProxy, AuthorizationResult authorizationResult)
 {
     return(ConfigureMockWebUI(platformProxy, authorizationResult, new Dictionary <string, string>()));
 }
 public TelemetryUploader(Action <ITelemetryEventPayload> dispatchAction, IPlatformProxy platformProxy, string appName)
 {
     _dispatchAction = dispatchAction;
     _platformProxy  = platformProxy;
     AppName         = appName;
 }
 public StorageManager(IPlatformProxy platformProxy, IStorageWorker storageWorker, IAdalLegacyCacheManager adalLegacyCacheManager = null)
 {
     _storageWorker         = storageWorker;
     AdalLegacyCacheManager = adalLegacyCacheManager ?? new AdalLegacyCacheManager(platformProxy.CreateLegacyCachePersistence());
 }
        public static IMatsTelemetryClient CreateMats(IApplicationConfiguration applicationConfiguration, IPlatformProxy platformProxy, IMatsConfig matsConfig)
        {
            string dpti = platformProxy.GetDevicePlatformTelemetryId();

            if (!IsDeviceEnabled(matsConfig.AudienceType, dpti))
            {
                return(null);
            }

            string deviceNetworkState = platformProxy.GetDeviceNetworkState();
            int    osPlatformCode     = platformProxy.GetMatsOsPlatformCode();

            bool         enableAggregation = true;
            IEventFilter eventFilter       = new EventFilter(enableAggregation);
            var          errorStore        = new ErrorStore();
            var          scenarioStore     = new ScenarioStore(TimeConstants.ScenarioTimeoutMilliseconds, errorStore);

            var allowedScopes = new HashSet <string>();

            if (matsConfig.AllowedScopes != null)
            {
                foreach (string s in matsConfig.AllowedScopes)
                {
                    allowedScopes.Add(s);
                }
            }

            var actionStore = new ActionStore(
                TimeConstants.ActionTimeoutMilliseconds,
                TimeConstants.AggregationWindowMilliseconds,
                errorStore,
                eventFilter,
                allowedScopes);

            var contextStore = ContextStore.CreateContextStore(
                matsConfig.AudienceType,
                applicationConfiguration.ClientName,
                applicationConfiguration.ClientVersion,
                dpti,
                deviceNetworkState,
                matsConfig.SessionId,
                osPlatformCode);

            IUploader uploader = new TelemetryUploader(matsConfig.DispatchAction, platformProxy, applicationConfiguration.ClientName);

            // it's this way in mats c++
            bool isScenarioUploadDisabled = true;

            return(new MatsTelemetryClient(
                       applicationConfiguration,
                       platformProxy,
                       errorStore,
                       uploader,
                       actionStore,
                       scenarioStore,
                       contextStore,
                       isScenarioUploadDisabled));
        }
Пример #33
0
 public AppService(IPlatformProxy platformProxy, IApplicationSettings applicationSettings)
 {
     _platformProxy       = platformProxy;
     _applicationSettings = applicationSettings;
     _servicePath         = _applicationSettings.AppPath;
 }
Пример #34
0
 public AppWallServices(IPlatformProxy platformProxy)
 {
     _platformProxy = platformProxy;
 }
Пример #35
0
 public UsersApi(IPlatformProxy platformProxy) : base(platformProxy)
 {
 }
Пример #36
0
 public AuthApi(IPlatformProxy platformProxy) : base(platformProxy)
 {
 }
Пример #37
0
 public ApiProductsService(IPlatformProxy platformProxy)
 {
     _platformProxy = platformProxy;
 }
 internal T WithPlatformProxy(IPlatformProxy platformProxy)
 {
     Config.PlatformProxy = platformProxy;
     return((T)this);
 }
Пример #39
0
 public void SetPlatformProxyForTest(IPlatformProxy platformProxy)
 {
     PlatformProxy = platformProxy;
 }
Пример #40
0
 public HomeController(IPlatformProxy platformProxy, IApplicationSettings applicationSettings, IPlatformSettings platformSettings)
 {
     _platformProxy = platformProxy;
     _applicationSettings = applicationSettings;
     _platformSettings = platformSettings;
 }
Пример #41
0
 public AppService(IPlatformProxy platformProxy, IApplicationSettings applicationSettings)
 {
     _platformProxy = platformProxy;
     _applicationSettings = applicationSettings;
     _servicePath = _applicationSettings.AppPath;
 }
Пример #42
0
 public TagController(IPlatformProxy platformProxy)
 {
     _platformProxy = platformProxy;
 }
 public TelemetryUploader(Action <IMatsTelemetryBatch> dispatchAction, IPlatformProxy platformProxy, string appName)
 {
     _dispatchAction = dispatchAction;
     _platformProxy  = platformProxy;
     AppName         = appName;
 }