Prevent clashes with git credentials
This commit is contained in:
@@ -7,6 +7,7 @@ namespace NugetSecretCredential;
|
|||||||
sealed class GitTokenCredentialProvider : ICredentialProvider
|
sealed class GitTokenCredentialProvider : ICredentialProvider
|
||||||
{
|
{
|
||||||
private const string TokenUserName = "nugetToken"; // can be anything constant
|
private const string TokenUserName = "nugetToken"; // can be anything constant
|
||||||
|
private const string ProtocolName = "nuget"; // prevent clash with git credentials
|
||||||
|
|
||||||
private const int MaxCredentialHelperTimeout = 2000;
|
private const int MaxCredentialHelperTimeout = 2000;
|
||||||
|
|
||||||
@@ -44,7 +45,7 @@ sealed class GitTokenCredentialProvider : ICredentialProvider
|
|||||||
// Credential helper executable not found
|
// Credential helper executable not found
|
||||||
return new GetAuthenticationCredentialsResponse(null, null, null, null, responseCode: MessageResponseCode.Error);
|
return new GetAuthenticationCredentialsResponse(null, null, null, null, responseCode: MessageResponseCode.Error);
|
||||||
|
|
||||||
pHelper.StandardInput.WriteLine("protocol=https");
|
pHelper.StandardInput.WriteLine("protocol=" + ProtocolName);
|
||||||
pHelper.StandardInput.WriteLine("username=" + TokenUserName);
|
pHelper.StandardInput.WriteLine("username=" + TokenUserName);
|
||||||
pHelper.StandardInput.WriteLine("host=" + request.Uri.DnsSafeHost);
|
pHelper.StandardInput.WriteLine("host=" + request.Uri.DnsSafeHost);
|
||||||
pHelper.StandardInput.WriteLine();
|
pHelper.StandardInput.WriteLine();
|
||||||
@@ -89,7 +90,7 @@ sealed class GitTokenCredentialProvider : ICredentialProvider
|
|||||||
// Credential helper executable not found
|
// Credential helper executable not found
|
||||||
return new GetAuthenticationCredentialsResponse(null, null, null, null, responseCode: MessageResponseCode.Error);
|
return new GetAuthenticationCredentialsResponse(null, null, null, null, responseCode: MessageResponseCode.Error);
|
||||||
|
|
||||||
pHelperStore.StandardInput.WriteLine("protocol=https");
|
pHelperStore.StandardInput.WriteLine("protocol=" + ProtocolName);
|
||||||
pHelperStore.StandardInput.WriteLine("username=" + TokenUserName);
|
pHelperStore.StandardInput.WriteLine("username=" + TokenUserName);
|
||||||
pHelperStore.StandardInput.WriteLine("password=" + password);
|
pHelperStore.StandardInput.WriteLine("password=" + password);
|
||||||
pHelperStore.StandardInput.WriteLine("host=" + request.Uri.DnsSafeHost);
|
pHelperStore.StandardInput.WriteLine("host=" + request.Uri.DnsSafeHost);
|
||||||
|
|||||||
Reference in New Issue
Block a user