/// <summary>
        /// Constructs an AuthenticatorApi instance using the provided client certificate
        /// for authentication.
        /// </summary>
        /// <typeparam name="T">The type of AuthenticatorApi instance to construct.</typeparam>
        /// <param name="certificate">Client certificate used for authentication.</param>
        /// <returns>The AuthenticatorApi instance.</returns>
        private T Create <T>(X509Certificate2 certificate)
        {
            var configuration = new Configuration();

            configuration.BasePath = _baseUrl;
            configuration.ApiClient.RestClient.HttpClientFactory = new Internal.ClientAuthHttpClientFactory(certificate);

            return(ApiFactoryUtils.CallConstructor <T>(new object[] { configuration }));
        }
Пример #2
0
        private T Create <T>(ISessionManager sessionManager, IApiExecutor apiExecutor = null)
        {
            if (apiExecutor == null)
            {
                var retryStrategy = new RefreshTokensRetryStrategy(sessionManager);
                apiExecutor = new RetryStrategyApiExecutor(retryStrategy);
            }

            var httpClient = HttpClientUtils.CreateClient(sessionManager.Certificate);

            return(ApiFactoryUtils.CallConstructor <T>(new object[] { sessionManager, _baseUrl, httpClient, apiExecutor }));
        }
Пример #3
0
        private T Create <T>(ISessionManager sessionManager, IApiExecutor apiExecutor = null)
        {
            var configuration = new Configuration();

            configuration.BasePath = _baseUrl;
            configuration.ApiClient.RestClient.HttpClientFactory = new Internal.ClientAuthHttpClientFactory(sessionManager.Certificate);

            if (apiExecutor == null)
            {
                var retryStrategy = new RefreshTokensRetryStrategy(sessionManager);
                apiExecutor = new RetryStrategyApiExecutor(retryStrategy);
            }

            return(ApiFactoryUtils.CallConstructor <T>(new object[] { sessionManager, configuration, apiExecutor }));
        }
Пример #4
0
        /// <summary>
        /// Constructs an AuthenticatorApi instance using the provided client certificate
        /// for authentication.
        /// </summary>
        /// <typeparam name="T">The type of AuthenticatorApi instance to construct.</typeparam>
        /// <param name="certificate">Client certificate used for authentication.</param>
        /// <returns>The AuthenticatorApi instance.</returns>
        private T Create <T>(X509Certificate2 certificate)
        {
            var apiClient = new ApiClient(_baseUrl)
            {
                RestClient =
                {
                    ClientCertificates = new X509Certificate2Collection
                    {
                        certificate
                    }
                }
            };
            var configuration = new Configuration(apiClient);

            return(ApiFactoryUtils.CallConstructor <T>(new object[] { configuration }));
        }
Пример #5
0
        private T Create <T>(ISessionManager sessionManager, IApiExecutor apiExecutor = null)
        {
            var apiClient = new ApiClient(_baseUrl)
            {
                RestClient =
                {
                    ClientCertificates = new X509Certificate2Collection
                    {
                        sessionManager.Certificate
                    }
                }
            };
            var configuration = new Configuration(apiClient);

            if (apiExecutor == null)
            {
                var retryStrategy = new RefreshTokensRetryStrategy(sessionManager);
                apiExecutor = new RetryStrategyApiExecutor(retryStrategy);
            }

            return(ApiFactoryUtils.CallConstructor <T>(new object[] { sessionManager, configuration, apiExecutor }));
        }
        /// <summary>
        /// Constructs an AuthenticatorApi instance using the provided client certificate
        /// for authentication.
        /// </summary>
        /// <typeparam name="T">The type of AuthenticatorApi instance to construct.</typeparam>
        /// <param name="certificate">Client certificate used for authentication.</param>
        /// <returns>The AuthenticatorApi instance.</returns>
        private T Create <T>(X509Certificate2 certificate)
        {
            var httpClient = HttpClientUtils.CreateClient(certificate);

            return(ApiFactoryUtils.CallConstructor <T>(new object[] { _baseUrl, httpClient }));
        }