Example #1
0
        private IMsalRequest CreateRequest(
            AuthenticationParameters authParameters,
            bool isInteractive)
        {
            var authParams = authParameters.Clone();

            authParams.TelemetryCorrelationId = _guidService.NewGuid();
            authParams.Logger = _platformProxy.CreateLogger(
                authParams.TelemetryCorrelationId,
                _msalClientConfiguration);

            var webRequestManager = new WebRequestManager(
                _httpManager,
                _platformProxy.GetSystemUtils(),
                _environmentMetadata,
                authParams);
            var cacheManager = new CacheManager(_storageManager, authParams);

            if (isInteractive)
            {
                return(new MsalInteractiveRequest(webRequestManager, cacheManager, _browserFactory, authParams));
            }
            else
            {
                return(new MsalBackgroundRequest(
                           webRequestManager,
                           cacheManager,
                           _platformProxy.GetSystemUtils(),
                           authParams));
            }
        }
        private IMsalRequest CreateRequest(
            AuthenticationParameters authParameters,
            bool isInteractive)
        {
            var authParams = authParameters.Clone();

            // "hack" to work around default constructors in legacy scenarios...
            if (string.IsNullOrWhiteSpace(authParams.ClientId))
            {
                authParams.ClientId = _msalClientConfiguration.DefaultClientId;
            }

            if (string.IsNullOrWhiteSpace(authParams.Authority))
            {
                authParams.Authority = _msalClientConfiguration.DefaultAuthority;
            }

            authParams.TelemetryCorrelationId = _guidService.NewGuid();
            authParams.Logger = _platformProxy.CreateLogger(
                authParams.TelemetryCorrelationId,
                _msalClientConfiguration);

            var webRequestManager = new WebRequestManager(
                _httpManager,
                _platformProxy.GetSystemUtils(),
                _environmentMetadata,
                authParams);
            var cacheManager = new CacheManager(_storageManager, authParams);

            if (isInteractive)
            {
                return(new MsalInteractiveRequest(webRequestManager, cacheManager, _browserFactory, authParams));
            }
            else
            {
                return(new MsalBackgroundRequest(
                           webRequestManager,
                           cacheManager,
                           _platformProxy.GetSystemUtils(),
                           authParams));
            }
        }