WIP add API Key authentication

This commit is contained in:
Robert Marshall 2020-06-24 07:47:59 +01:00
parent 005eea35e2
commit 3f1ab3eb12
5 changed files with 104 additions and 2 deletions

View file

@ -1,10 +1,19 @@
using Robware.Auth.API;
using System;
using System.Threading.Tasks;
namespace Robware.Data {
public class ApiKeyRepository : IApiKeys {
public Task<ApiKey> Get(string key) {
throw new System.NotImplementedException();
public async Task<ApiKey> Get(string key) {
if (key=="denied")
throw new ApiKeyNotFoundException(key);
return new ApiKey {
Name = "Hardcoded key",
Key = key,
Enabled = true,
IssueTimestamp = DateTime.Now
};
}
}
}