mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
* Remove OpenIddict * Add API Key system * Revert removing OpenIddict * fix rebase * fix tests * pr changes * fix tests * fix apikey test * pr change * fix db * add migration attrs * fix migration error * PR Changes * Fix sqlite migration * change api key to use Authorization Header * add supportAddForeignKey * use tempdata status message * fix add api key css * remove redirect url + app identifier feature :(
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Immutable;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BTCPayServer.Data
|
|
{
|
|
public class APIKeyData
|
|
{
|
|
[MaxLength(50)]
|
|
public string Id
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[MaxLength(50)] public string StoreId { get; set; }
|
|
|
|
[MaxLength(50)] public string UserId { get; set; }
|
|
|
|
public APIKeyType Type { get; set; } = APIKeyType.Legacy;
|
|
public string Permissions { get; set; }
|
|
|
|
public StoreData StoreData { get; set; }
|
|
public ApplicationUser User { get; set; }
|
|
public string[] GetPermissions() { return Permissions?.Split(';') ?? new string[0]; }
|
|
|
|
public void SetPermissions(IEnumerable<string> permissions)
|
|
{
|
|
Permissions = string.Join(';',
|
|
permissions?.Select(s => s.Replace(";", string.Empty)) ?? new string[0]);
|
|
}
|
|
}
|
|
|
|
public enum APIKeyType
|
|
{
|
|
Legacy,
|
|
Permanent
|
|
}
|
|
}
|