Moved the ProxyAuthenticationMethod enum to the HTTP class so the VNCControl can compile.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2017-01-20 14:47:04 +00:00
parent 09973b1fef
commit 88b4104dac
7 changed files with 26 additions and 27 deletions

View File

@ -88,12 +88,12 @@ namespace XenAdmin.Dialogs.OptionsPages
{
AuthenticationCheckBox.Checked = Properties.Settings.Default.ProvideProxyAuthentication;
switch ((HTTPHelper.ProxyAuthenticationMethod)Properties.Settings.Default.ProxyAuthenticationMethod)
switch ((HTTP.ProxyAuthenticationMethod)Properties.Settings.Default.ProxyAuthenticationMethod)
{
case HTTPHelper.ProxyAuthenticationMethod.Basic:
case HTTP.ProxyAuthenticationMethod.Basic:
BasicRadioButton.Checked = true;
break;
case HTTPHelper.ProxyAuthenticationMethod.Digest:
case HTTP.ProxyAuthenticationMethod.Digest:
DigestRadioButton.Checked = true;
break;
default:
@ -248,8 +248,8 @@ namespace XenAdmin.Dialogs.OptionsPages
Properties.Settings.Default.ProxyPassword = EncryptionUtils.Protect(ProxyPasswordTextBox.Text);
Properties.Settings.Default.ProvideProxyAuthentication = AuthenticationCheckBox.Checked;
HTTPHelper.ProxyAuthenticationMethod new_auth_method = BasicRadioButton.Checked ?
HTTPHelper.ProxyAuthenticationMethod.Basic : HTTPHelper.ProxyAuthenticationMethod.Digest;
HTTP.ProxyAuthenticationMethod new_auth_method = BasicRadioButton.Checked ?
HTTP.ProxyAuthenticationMethod.Basic : HTTP.ProxyAuthenticationMethod.Digest;
if (Properties.Settings.Default.ProxyAuthenticationMethod != (int)new_auth_method)
Properties.Settings.Default.ProxyAuthenticationMethod = (int)new_auth_method;
}
@ -286,7 +286,7 @@ namespace XenAdmin.Dialogs.OptionsPages
Properties.Settings.Default.ProvideProxyAuthentication,
Properties.Settings.Default.ProxyUsername,
Properties.Settings.Default.ProxyPassword,
(HTTPHelper.ProxyAuthenticationMethod)Properties.Settings.Default.ProxyAuthenticationMethod).RunAsync();
(HTTP.ProxyAuthenticationMethod)Properties.Settings.Default.ProxyAuthenticationMethod).RunAsync();
}
#endregion

View File

@ -519,7 +519,7 @@ namespace XenAdmin
Properties.Settings.Default.ProvideProxyAuthentication,
Properties.Settings.Default.ProxyUsername,
Properties.Settings.Default.ProxyPassword,
(HTTPHelper.ProxyAuthenticationMethod)Properties.Settings.Default.ProxyAuthenticationMethod).RunAsync();
(HTTP.ProxyAuthenticationMethod)Properties.Settings.Default.ProxyAuthenticationMethod).RunAsync();
}
catch (ConfigurationErrorsException ex)
{

View File

@ -1054,13 +1054,13 @@ namespace XenAdmin
foreach (var module in modulesToUnregister)
AuthenticationManager.Unregister(module);
var authSetting = (HTTPHelper.ProxyAuthenticationMethod)Properties.Settings.Default.ProxyAuthenticationMethod;
if (authSetting == HTTPHelper.ProxyAuthenticationMethod.Basic)
var authSetting = (HTTP.ProxyAuthenticationMethod)Properties.Settings.Default.ProxyAuthenticationMethod;
if (authSetting == HTTP.ProxyAuthenticationMethod.Basic)
AuthenticationManager.Register(BasicAuthenticationModule);
else
AuthenticationManager.Register(DigestAuthenticationModule);
XenAPI.HTTP.ProxyAuthenticationMethod = authSetting;
XenAPI.HTTP.CurrentProxyAuthenticationMethod = authSetting;
}
private const string SplashWindowClass = "XenCenterSplash0001";

View File

@ -47,11 +47,11 @@ namespace XenAdmin.Actions
private bool bypassProxyForServers;
private bool provideProxyCredentials;
private string proxyUsername;
private string proxyPassword;
private HTTPHelper.ProxyAuthenticationMethod proxyAuthenticationMethod;
private string proxyPassword;
private HTTP.ProxyAuthenticationMethod proxyAuthenticationMethod;
public TransferProxySettingsAction(HTTPHelper.ProxyStyle style, string address, int port, int timeout,
bool suppressHistory, bool bypassForServer, bool provideCredentials, string username, string password, HTTPHelper.ProxyAuthenticationMethod proxyAuthMethod)
public TransferProxySettingsAction(HTTPHelper.ProxyStyle style, string address, int port, int timeout,
bool suppressHistory, bool bypassForServer, bool provideCredentials, string username, string password, HTTP.ProxyAuthenticationMethod proxyAuthMethod)
: base(null, Messages.ACTION_TRANSFER_HEALTHCHECK_SETTINGS, Messages.ACTION_TRANSFER_HEALTHCHECK_SETTINGS, suppressHistory)
{
proxyStyle = style;

View File

@ -52,13 +52,6 @@ namespace XenAPI
SpecifiedProxy = 2
}
public enum ProxyAuthenticationMethod
{
// Note that these numbers make it into user settings files, so need to be preserved.
Basic = 0,
Digest = 1
}
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

View File

@ -130,11 +130,17 @@ namespace XenAPI
public const int DEFAULT_HTTPS_PORT = 443;
public enum ProxyAuthenticationMethod
{
Basic = 0,
Digest = 1
}
/// <summary>
/// The authentication scheme to use for authenticating XenCenter to a proxy server.
/// The authentication scheme to use for authenticating to a proxy server.
/// Defaults to Digest.
/// </summary>
public static HTTPHelper.ProxyAuthenticationMethod ProxyAuthenticationMethod = HTTPHelper.ProxyAuthenticationMethod.Digest;
public static ProxyAuthenticationMethod CurrentProxyAuthenticationMethod = ProxyAuthenticationMethod.Digest;
#region Helper functions
@ -484,7 +490,7 @@ namespace XenAPI
string basicField = fields.Find(str => str.StartsWith("Proxy-Authenticate: Basic"));
string digestField = fields.Find(str => str.StartsWith("Proxy-Authenticate: Digest"));
if (ProxyAuthenticationMethod == HTTPHelper.ProxyAuthenticationMethod.Basic)
if (CurrentProxyAuthenticationMethod == HTTP.ProxyAuthenticationMethod.Basic)
{
if (string.IsNullOrEmpty(basicField))
throw new ProxyServerAuthenticationException("Basic authentication scheme is not supported/enabled by the proxy server.");
@ -495,7 +501,7 @@ namespace XenAPI
WriteLine(authenticationFieldReply, stream);
WriteLine(stream);
}
else if (ProxyAuthenticationMethod == HTTPHelper.ProxyAuthenticationMethod.Digest)
else if (CurrentProxyAuthenticationMethod == HTTP.ProxyAuthenticationMethod.Digest)
{
if (string.IsNullOrEmpty(digestField))
throw new ProxyServerAuthenticationException("Digest authentication scheme is not supported/enabled by the proxy server.");

View File

@ -76,8 +76,8 @@ namespace XenServerHealthCheck
public static void ReconfigureConnectionSettings()
{
XenAPI.Session.Proxy = XenAdminConfigManager.Provider.GetProxyFromSettings(null);
XenAPI.HTTP.ProxyAuthenticationMethod =
(HTTPHelper.ProxyAuthenticationMethod)Properties.Settings.Default.ProxyAuthenticationMethod;
XenAPI.HTTP.CurrentProxyAuthenticationMethod =
(HTTP.ProxyAuthenticationMethod)Properties.Settings.Default.ProxyAuthenticationMethod;
}
protected override void OnStart(string[] args)