/// <summary> /// Create a new event data object /// </summary> public CredentialsRequiredEventArgs(string endpointUri, Guid repositoryId, bool authFailed, IWebAuthenticationProvider authenticationProvider) { EndpointUri = endpointUri; RepositoryId = repositoryId; AuthenticationProvider = authenticationProvider; Cancel = false; AuthenticationFailed = authFailed; }
/// <summary> /// Get credentials for the specified URL target and repository information /// </summary> /// <param name="entryUri">The URI of the endpoint that the credentials are for</param> /// <param name="useApiKey">True if an API key was used to originally set up the connection</param> /// <param name="repositoryId">The owner Id to specify to the server (for example repository Id)</param> /// <param name="keyContainerName">The name of the key container to retrieve the private key from</param> /// <param name="useMachineStore">True to use the machine store instead of the user store for the digital certificate</param> /// <returns></returns> /// <remarks>If existing credentials are available they will be provided, otherwise a new credentials object will be created and returned. /// This method is Multithread safe.</remarks> private static IWebAuthenticationProvider GetCredentials(string entryUri, bool useApiKey, Guid repositoryId, string keyContainerName, bool useMachineStore) { IWebAuthenticationProvider credentials = GetCachedCredentials(entryUri, useApiKey, repositoryId, keyContainerName, useMachineStore); if (credentials == null) { //we failed to get them above - so we need to ask the user (outside of our lock so we don't block the world) credentials = RequestUserCredentials(entryUri, repositoryId); } return(credentials); }