A authentication manager for a manually implemented authentication.
		/// <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>
		/// Construct a new RallyRestApi configured to work with the specified WSAPI version
		/// </summary>
		/// <param name="authManger">The authorization manager to use when authentication requires it. If no driver is 
		/// provided a console authentication manager will be used which does not allow SSO authentication.</param>
		/// <param name="webServiceVersion">The WSAPI version to use (defaults to DEFAULT_WSAPI_VERSION)</param>
		/// <example>
		/// For a console application, no authentication manager is needed as shown in this example.
		/// <code language="C#">
		/// RallyRestApi restApi = new RallyRestApi();
		/// </code>
		/// For UI applications, an authentication manager must be provided. The authentication providers will 
		/// configure the API and create the linkages as part of the constructor. Please see the documentation for 
		/// the RestApiAuthMgrWpf and RestApiAuthMgrWinforms for more information.
		/// <code language="C#">
		/// // You must define your own private application token. This ensures that your login details are not overwritten by someone else.
		/// string applicationToken = "RallyRestAPISample";
		/// // You must set a user specific salt for encryption.
		/// string encryptionKey = "UserSpecificSaltForEncryption";
		/// // You must define your own encryption routines.
		/// IEncryptionRoutines encryptionUtilities = new EncryptionUtilities();
		/// 
		/// // Instantiate authorization manager
		/// wpfAuthMgr = new RestApiAuthMgrWpf(applicationToken, encryptionKey, encryptionUtilities);
		/// </code>
		/// </example>
		public RallyRestApi(ApiAuthManager authManger = null, string webServiceVersion = DEFAULT_WSAPI_VERSION)
		{
			// NOTE: The example for using the RestApiAuthMgrWpf is also shown there. Make sure you 
			// update both if you change it.

			if (authManger == null)
				authManger = new ApiConsoleAuthManager();

			this.authManger = authManger;

			WsapiVersion = webServiceVersion;
			if (String.IsNullOrWhiteSpace(WsapiVersion))
				WsapiVersion = DEFAULT_WSAPI_VERSION;

			AuthenticationState = AuthenticationResult.NotAuthorized;
		}
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="authMgr">The authorization manager that owns these login details.</param>
		public LoginDetails(ApiAuthManager authMgr)
		{
			ConnectionType = ConnectionType.BasicAuth;
			this.authMgr = authMgr;
		}
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="authMgr">The authorization manager that owns these login details.</param>
 public LoginDetails(ApiAuthManager authMgr)
 {
     ConnectionType = ConnectionType.BasicAuth;
     this.authMgr   = authMgr;
 }
		/// <summary>
		/// Construct a new RallyRestApi configured to work with the specified WSAPI version
		/// </summary>
		/// <param name="authManger">The authorization manager to use when authentication requires it. If no driver is 
		/// provided a console authentication manager will be used which does not allow SSO authentication.</param>
		/// <param name="webServiceVersion">The WSAPI version to use (defaults to DEFAULT_WSAPI_VERSION)</param>
		/// <param name="maxRetries">Requests will be attempted a number of times (defaults to 3)</param>
		/// <param name="traceInfo">Controls diagnostic trace information being logged</param>
		/// <example>
		/// For a console application, no authentication manager is needed as shown in this example.
		/// <code language="C#">
		/// RallyRestApi restApi = new RallyRestApi();
		/// </code>
		/// For UI applications, an authentication manager must be provided. The authentication providers will 
		/// configure the API and create the linkages as part of the constructor. Please see the documentation for 
		/// the RestApiAuthMgrWpf and RestApiAuthMgrWinforms for more information.
		/// <code language="C#">
		/// // You must define your own private application token. This ensures that your login details are not overwritten by someone else.
		/// string applicationToken = "RallyRestAPISample";
		/// // You must set a user specific salt for encryption.
		/// string encryptionKey = "UserSpecificSaltForEncryption";
		/// // You must define your own encryption routines.
		/// IEncryptionRoutines encryptionUtilities = new EncryptionUtilities();
		/// 
		/// // Instantiate authorization manager
		/// wpfAuthMgr = new RestApiAuthMgrWpf(applicationToken, encryptionKey, encryptionUtilities);
		/// </code>
		/// </example>
		public RallyRestApi(ApiAuthManager authManger = null, string webServiceVersion = DEFAULT_WSAPI_VERSION, int maxRetries = 3, TraceFieldEnum traceInfo = RallyRestApi.DEFAULT_TRACE_FIELDS)
		{
			// NOTE: The example for using the RestApiAuthMgrWpf is also shown there. Make sure you 
			// update both if you change it.

			TraceHelper.TraceFields = traceInfo;

			if (authManger == null)
				authManger = new ApiConsoleAuthManager(webServiceVersion, traceInfo);

			this.authManger = authManger;

			WsapiVersion = webServiceVersion;
			if (String.IsNullOrWhiteSpace(WsapiVersion))
				WsapiVersion = DEFAULT_WSAPI_VERSION;

			AuthenticationState = AuthenticationResult.NotAuthorized;

			this.maxRetries = maxRetries;
		}