public IHttpClient CreateHttpClient(RepositoryConnectionString connectionString, IHttpClientCredentials credentials)
        {
            if (connectionString == null)
            {
                return(null);
            }
            var factory = this.GetHttpClientTypedFactoryByAuthenticationMode(connectionString.AuthenticationMode);

            if (factory != null)
            {
                if (credentials == null)
                {
                    credentials = factory.CreateHttpClientCredentials(connectionString);
                }
                return(factory.CreateHttpClient(connectionString, credentials));
            }
            else
            {
                factory = this.GetHttpClientTypedFactoryByAuthenticationMode("Default");
                if (factory != null)
                {
                    return(factory.CreateHttpClient(connectionString, credentials));
                }
                else
                {
                    //return new HttpClientImplementation(connectionString);
                    return(null);
                }
            }
        }
        public IHttpClientCredentials CreateHttpClientCredentials(RepositoryConnectionString connectionString)
        {
            if (connectionString == null)
            {
                return(null);
            }
            var factory = this.GetHttpClientTypedFactoryByAuthenticationMode(connectionString.AuthenticationMode);

            if (factory != null)
            {
                return(factory.CreateHttpClientCredentials(connectionString));
            }
            else
            {
#warning HERE  CreateHttpClientCredentials
                //factory = this.GetHttpClientTypedFactoryByAuthenticationMode("Default");
                //if (factory != null) {
                //    return factory.CreateHttpClientCredentials(connectionString);
                //} else {
                //    //return new HttpClientImplementation(connectionString);
                //    return null;
                //}
                throw new NotImplementedException("CreateHttpClientCredentials");
            }
        }
        public IHttpClient CreateHttpClient(RepositoryConnectionString connectionString, IHttpClientCredentials credentials)
        {
            var url    = connectionString.GetUrlNormalized();
            var result = new HttpClientImplementation(url, credentials);

            return(result);
        }
Exemplo n.º 4
0
 public virtual void SetConnectionString(RepositoryConnectionString connectionString, string suffix)
 {
     if (string.IsNullOrEmpty(suffix))
     {
         this.ConnectionString = connectionString;
     }
     else
     {
         this.ConnectionString = connectionString.CreateWithSuffix(suffix);
     }
 }
Exemplo n.º 5
0
        public ServiceClientCredentials CreateServiceClientCredentials(
            RepositoryConnectionString connectionString
            )
        {
            var authenticationMode = connectionString.AuthenticationMode;
            var cmp = StringComparer.OrdinalIgnoreCase;
            var serviceClientCredentialsFactories = this.GetServiceClientCredentialsFactories();

            foreach (var factory in serviceClientCredentialsFactories)
            {
                var factoryAuthenticationMode = factory.GetAuthenticationMode();
                if (cmp.Equals(factoryAuthenticationMode, authenticationMode))
                {
                    return(factory.CreateServiceClientCredentials(connectionString));
                }
            }
            return(null);
        }
Exemplo n.º 6
0
        public ServiceClientCredentials CreateServiceClientCredentials(RepositoryConnectionString connectionString)
        {
            var logger = this._Logger ?? (this._Logger = this._LoggerFactory.CreateLogger("Authentication"));

            return(new SharePointOnlineServiceClientCredentials(connectionString, logger));
        }
Exemplo n.º 7
0
 public SharePointOnlineServiceClientCredentials(RepositoryConnectionString connectionString, ILogger logger)
 {
     this._Logger         = logger;
     this._SPOCredentials = new SharePointOnlineCredentials(connectionString.User, connectionString.Password, logger);
 }
 public IHttpClientCredentials CreateHttpClientCredentials(RepositoryConnectionString connectionString)
 {
     throw new NotImplementedException();
 }