public V1CredsAPIConnector(string urlPrefix, System.Net.ICredentials creds = null, ProxyProvider proxy = null) { _urlPrefix = urlPrefix; _proxyProvider = proxy; _creds = creds ?? CredentialCache.DefaultCredentials; var myproxy = _proxyProvider == null ? null : _proxyProvider.CreateWebProxy(); }
public V1APIConnector(string urlPrefix, string username = null, string password = null, bool? integratedAuth = null, ProxyProvider proxy = null) : base(urlPrefix, new CredentialCache(), proxy) { var cache = _creds as CredentialCache; var uri = new Uri(urlPrefix); if (username == null) { if (integratedAuth.GetValueOrDefault(true)) { // no constructor args - so use default integrated identity unless they say no. cache.Add(uri, "NTLM", CredentialCache.DefaultNetworkCredentials); cache.Add(uri, "Negotiate", CredentialCache.DefaultNetworkCredentials); } } else { var userPassCred = new NetworkCredential(username, password); cache.Add(uri, "Basic", userPassCred); if (!integratedAuth.GetValueOrDefault(false)) { // If there's a username, we'll assume the user doesn't want Windows Auth unless they ask. cache.Add(uri, "NTLM", userPassCred); cache.Add(uri, "Negotiate", userPassCred); } } }
public V1APIConnector(string urlPrefix, string username = null, string password = null, bool? integratedAuth = null, ProxyProvider proxy = null, OAuth2Client.IStorage storage = null) : base(urlPrefix, new CredentialCache(), proxy) { var cache = _creds as CredentialCache; var uri = new Uri(urlPrefix); // Try the OAuth2 credential OAuth2Client.IStorage oauth2storage = null; if (storage != null) { oauth2storage = storage; } else { try { var s = OAuth2Client.Storage.JsonFileStorage.Default as OAuth2Client.IStorage; s.GetSecrets(); oauth2storage = s; } catch (System.IO.FileNotFoundException) { // swallowed - meaning no oauth2 secrets configured. } } if (oauth2storage != null) { cache.Add(uri, "Bearer", new OAuth2Client.OAuth2Credential( "apiv1", oauth2storage, proxy != null ? proxy.CreateWebProxy() : null ) ); } if (username == null) { if (integratedAuth.GetValueOrDefault(true)) { // no constructor args - so use default integrated identity unless they say no. cache.Add(uri, "NTLM", CredentialCache.DefaultNetworkCredentials); cache.Add(uri, "Negotiate", CredentialCache.DefaultNetworkCredentials); } } else { var userPassCred = new NetworkCredential(username, password); cache.Add(uri, "Basic", userPassCred); if (!integratedAuth.GetValueOrDefault(false)) { // If there's a username, we'll assume the user doesn't want Windows Auth unless they ask. cache.Add(uri, "NTLM", userPassCred); cache.Add(uri, "Negotiate", userPassCred); } } }
public V1ConnectionValidator( string connectionUrl, string username, string password, bool integratedAuth, ProxyProvider proxyProvider) : this(connectionUrl, username, password, integratedAuth) { _proxyProvider = proxyProvider; }
private IAPIConnector MakeConnector(string path, ProxyProvider proxy=null) { if (_storage == null) { return new V1APIConnector(path, _credentials.V1UserName, _credentials.V1Password, _useWindowsIntegratedAuth, proxy); } return new V1OAuth2APIConnector(path, _storage, proxy); }
private IAPIConnector MakeConnector(string path, ProxyProvider proxy = null) { var connector = new VersionOneAPIConnector(path, proxyProvider: proxy); connector.WithVersionOneUsernameAndPassword(_credentials.V1UserName, _credentials.V1Password); if (_useWindowsIntegratedAuth) connector.WithWindowsIntegratedAuthentication(); return connector; }
public VersionOneAPIConnector(string urlPrefix, System.Net.ICredentials credentials = null, ProxyProvider proxyProvider = null) { _urlPrefix = urlPrefix; _proxyProvider = proxyProvider; if (credentials != null) { _initializedWithCredentials = true; Credentials = credentials; } else { _credentialCache = new CredentialCache(); Credentials = _credentialCache; } }
private IAPIConnector MakeConnector(string path, ProxyProvider proxy = null) { var connector = new VersionOneAPIConnector(path, proxyProvider: proxy); if (_storage != null) return connector.WithOAuth2(_storage); if (_useWindowsIntegratedAuth) return connector.WithWindowsIntegratedAuthentication(); if (!string.IsNullOrWhiteSpace(_credentials.V1UserName)) return connector .WithVersionOneUsernameAndPassword(_credentials.V1UserName, _credentials.V1Password); throw new Exception("It was not possible to create a connector with the current authentication configuration."); }
public V1OAuth2APIConnector(string urlPrefix, IStorage storage = null, ProxyProvider proxy = null) : base(urlPrefix, storage: storage, proxy: proxy) { }
public V1APIConnector(string url, string username, string password, bool integratedAuth, ProxyProvider proxyProvider) : this(url, username, password, integratedAuth) { this.proxyProvider = proxyProvider; }
public V1OAuth2APIConnector(string url, IStorage storage, ProxyProvider proxyProvider=null) : this(url, storage) { this.proxyProvider = proxyProvider; }
public V1OAuth2APIConnector(string url, ProxyProvider proxyProvider = null) : this(url) { this.proxyProvider = proxyProvider; }