Load api keys from database. Create api keys.
This commit is contained in:
parent
8d1598ca31
commit
2f38780d2f
2 changed files with 34 additions and 0 deletions
13
src/Robware.Data/ApiKeys/DatabaseApiKey.cs
Normal file
13
src/Robware.Data/ApiKeys/DatabaseApiKey.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
using Robware.Auth.API;
|
||||||
|
using Robware.Data.ApiKeys.State;
|
||||||
|
|
||||||
|
namespace Robware.Data.ApiKeys {
|
||||||
|
public class DatabaseApiKey:ApiKey {
|
||||||
|
public DatabaseApiKey(ApiKeyState state) {
|
||||||
|
Name = state.Name;
|
||||||
|
Key = state.Key;
|
||||||
|
IssueTimestamp = state.IssueTimestamp;
|
||||||
|
Enabled = state.Enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
src/Robware.Data/ApiKeys/State/ApiKeyState.cs
Normal file
21
src/Robware.Data/ApiKeys/State/ApiKeyState.cs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
using MongoDB.Bson.Serialization.Attributes;
|
||||||
|
using Robware.Auth.API;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Robware.Data.ApiKeys.State {
|
||||||
|
public class ApiKeyState {
|
||||||
|
public ApiKeyState(ApiKey apiKey) {
|
||||||
|
Name = apiKey.Name;
|
||||||
|
IssueTimestamp = apiKey.IssueTimestamp;
|
||||||
|
Key = apiKey.Key;
|
||||||
|
Enabled = apiKey.Enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BsonId]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public DateTime IssueTimestamp { get; set; }
|
||||||
|
public string Key { get; set; }
|
||||||
|
public bool Enabled { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue