/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="authManager">The authorization manager to use.</param>
		/// <param name="connectionInfo">Connection Information</param>
		internal HttpService(ApiAuthManager authManager, ConnectionInfo connectionInfo)
		{
			if (authManager == null)
				throw new ArgumentNullException("authManager");

			if (connectionInfo == null)
				throw new ArgumentNullException("connectionInfo");

			this.authManager = authManager;
			this.connectionInfo = connectionInfo;

			if (connectionInfo.AuthType == AuthorizationType.Basic)
			{
				Server = connectionInfo.Server;
				credentials = new CredentialCache { { connectionInfo.Server, "Basic", new NetworkCredential(connectionInfo.UserName, connectionInfo.Password) } };
			}
			else if (connectionInfo.AuthType == AuthorizationType.ZSessionID)
			{
				Server = connectionInfo.Server;
				credentials = null;
			}
			else if (connectionInfo.AuthType == AuthorizationType.ApiKey)
			{
				Server = connectionInfo.Server;
				credentials = new CredentialCache { { connectionInfo.Server, "Basic", new NetworkCredential(connectionInfo.ApiKey, connectionInfo.ApiKey) } };
			}
		}
		/// <summary>
		/// Performs SSO Authentication
		/// </summary>
		/// <returns></returns>
		internal bool PerformSsoAuthentication()
		{
			if ((authManager == null) || (!authManager.IsUiSupported))
				return false;

			ConnectionInfo ssoConnection = new ConnectionInfo();
			ssoConnection.AuthType = AuthorizationType.Basic;
			ssoConnection.Server = new Uri(String.Format("{0}login/key.js", connectionInfo.Server.AbsoluteUri));
			ssoConnection.Port = connectionInfo.Port;
			ssoConnection.Proxy = connectionInfo.Proxy;
			ssoConnection.UserName = connectionInfo.UserName;

			HttpService ssoService = new HttpService(authManager, ssoConnection);
			Uri ssoRedirectUri = ssoConnection.Server;
			if (ssoService.PerformSsoCheck(out ssoRedirectUri))
			{
				authManager.OpenSsoPage(ssoRedirectUri);

				return true;
			}

			return false;
		}