Orc.NuGetExplorer.CredentialProvider.GetCredentials C# (CSharp) Method

GetCredentials() public method

public GetCredentials ( Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying ) : ICredentials
uri System.Uri
proxy IWebProxy
credentialType CredentialType
retrying bool
return ICredentials
        public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying)
        {
            // Note: this might cause deadlock, but NuGet is sync while we need async, so keep it this way
            var credentialsTask = _authenticationProvider.GetCredentialsAsync(uri, retrying);
            var credentials = credentialsTask.Result;

            if (credentials == null || (string.IsNullOrWhiteSpace(credentials.UserName) && string.IsNullOrWhiteSpace(credentials.Password)))
            {
                return null;
            }

            return new NetworkCredential(credentials.UserName, credentials.Password);
        }
        #endregion