API key protection
This commit is contained in:
parent
cd72b7b9aa
commit
38bb7e40ef
7 changed files with 143 additions and 19 deletions
|
|
@ -31,12 +31,12 @@ namespace isnd.Controllers
|
|||
try
|
||||
{
|
||||
var clientVersionId = Request.Headers["X-NuGet-Client-Version"];
|
||||
string apiKey = Request.Headers["X-NuGet-ApiKey"][0];
|
||||
string apiKey = Request.Headers["X-NuGet-ApiKey"].FirstOrDefault() ?? string.Empty;
|
||||
ViewData["versionId"] = typeof(PackagesController).Assembly.FullName;
|
||||
var files = new List<string>();
|
||||
ViewData["files"] = files;
|
||||
|
||||
var clearkey = protector.Unprotect(apiKey);
|
||||
var clearkey = ApiKeyProtector.UnprotectWithFallback(protector, apiKey);
|
||||
var apikey = dbContext.ApiKeys.SingleOrDefault(k => k.Id == clearkey);
|
||||
if (apikey == null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue