Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update External Account Linking Flow #5338

Merged
merged 13 commits into from
Jan 30, 2018
Prev Previous commit
Next Next commit
throw if credential type is null and credential is removed
Scott Bommarito committed Jan 29, 2018
commit a6717945fa1abd44c68d3f305f233e03bd37da8e
13 changes: 11 additions & 2 deletions src/NuGetGallery.Core/Auditing/CredentialAuditRecord.cs
Original file line number Diff line number Diff line change
@@ -31,10 +31,19 @@ public CredentialAuditRecord(Credential credential, bool removed)
Identity = credential.Identity;

// Track the value for credentials that are definitely revocable (API Key, etc.) and have been removed
if (removed && !credential.IsPassword())
if (removed)
{
Value = credential.Value;
if (Type == null)
{
throw new ArgumentNullException(nameof(credential.Type));
}

if (!credential.IsPassword())
{
Value = credential.Value;
}
}

Created = credential.Created;
Expires = credential.Expires;
LastUsed = credential.LastUsed;