Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ApiKey.cs
1using System;
5
7{
8 [CollectionName("ApiKeys")]
9 [TypeName(TypeNameSerialization.None)]
10 [ArchivingTime]
11 [Index("Key")]
12 [Index("Owner", "Key")]
13 public class ApiKey
14 {
15 private static readonly object[] approvedSources = new object[]
16 {
17 typeof(XmppServerModule).Assembly,
18 typeof(Persistence.NeuroLedger.NeuroLedgerProvider),
19 typeof(Content.Markdown.Web.MarkdownToHtmlConverter),
20 Account.FromSaveUnsaved,
21 Account.FromUpdateObject
22 };
23
24 private string objectId = null;
25 private string key = string.Empty;
26 private string secret = string.Empty;
27 private string owner = string.Empty;
29 private DateTime created = DateTime.MinValue;
30 private DateTime firstAccount = DateTime.MinValue;
31 private DateTime lastAccount = DateTime.MinValue;
32 private long maxAccounts = 0;
33 private long nrCreated = 0;
34 private long nrDeleted = 0;
35
36 public ApiKey()
37 {
38 }
39
40 [ObjectId]
41 public string ObjectId
42 {
43 get => this.objectId;
44 set => this.objectId = value;
45 }
46
47 public string Key
48 {
49 get => this.key;
50 set => this.key = value;
51 }
52
53 [DefaultValueStringEmpty]
54 public string Secret
55 {
56 get
57 {
58 Assert.CallFromSource(approvedSources);
59 return this.secret;
60 }
61
62 set
63 {
64 Assert.CallFromSource(approvedSources);
65 this.secret = value;
66 }
67 }
68
69 public string Owner
70 {
71 get => this.owner;
72 set => this.owner = value;
73 }
74
75 [DefaultValueStringEmpty]
76 public CaseInsensitiveString EMail
77 {
78 get => this.eMail;
79 set => this.eMail = value;
80 }
81
82 [DefaultValueDateTimeMinValue]
83 public DateTime Created
84 {
85 get => this.created;
86 set => this.created = value;
87 }
88
89 [DefaultValueDateTimeMinValue]
90 public DateTime FirstAccount
91 {
92 get => this.firstAccount;
93 set => this.firstAccount = value;
94 }
95
96 [DefaultValueDateTimeMinValue]
97 public DateTime LastAccount
98 {
99 get => this.lastAccount;
100 set => this.lastAccount = value;
101 }
102
103 [DefaultValue(0L)]
104 public long MaxAccounts
105 {
106 get => this.maxAccounts;
107 set => this.maxAccounts = value;
108 }
109
110 [DefaultValue(0L)]
111 public long NrCreated
112 {
113 get => this.nrCreated;
114 set => this.nrCreated = value;
115 }
116
117 [DefaultValue(0L)]
118 public long NrDeleted
119 {
120 get => this.nrDeleted;
121 set => this.nrDeleted = value;
122 }
123 }
124}
Represents a case-insensitive string.
static readonly CaseInsensitiveString Empty
Empty case-insensitive string
Static class containing methods that can be used to make sure calls are made from appropriate locatio...
Definition: Assert.cs:15
static void CallFromSource(params string[] Sources)
Makes sure the call is made from one of the listed sources.
Definition: Assert.cs:39
Contains information about a broker account.
Definition: Account.cs:28
Service Module hosting the XMPP broker and its components.
TypeNameSerialization
How the type name should be serialized.