diff --git a/BTCPayServer.Data/BTCPayServer.Data.csproj b/BTCPayServer.Data/BTCPayServer.Data.csproj index a87e1ddd2..ba80cab0d 100644 --- a/BTCPayServer.Data/BTCPayServer.Data.csproj +++ b/BTCPayServer.Data/BTCPayServer.Data.csproj @@ -6,14 +6,14 @@ - + - - - - - + + + + + diff --git a/BTCPayServer.Data/Migrations/20200110064617_OpenIddictUpdate.cs b/BTCPayServer.Data/Migrations/20200110064617_OpenIddictUpdate.cs new file mode 100644 index 000000000..1e10e1a7e --- /dev/null +++ b/BTCPayServer.Data/Migrations/20200110064617_OpenIddictUpdate.cs @@ -0,0 +1,60 @@ +using BTCPayServer.Data; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace BTCPayServer.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200110064617_OpenIddictUpdate")] + public partial class OpenIddictUpdate : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Subject", + table: "OpenIddictTokens", + maxLength: 450, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 450); + + migrationBuilder.AlterColumn( + name: "Subject", + table: "OpenIddictAuthorizations", + maxLength: 450, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 450); + + migrationBuilder.AddColumn( + name: "Requirements", + table: "OpenIddictApplications", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Requirements", + table: "OpenIddictApplications"); + + migrationBuilder.AlterColumn( + name: "Subject", + table: "OpenIddictTokens", + maxLength: 450, + nullable: false, + oldClrType: typeof(string), + oldMaxLength: 450, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Subject", + table: "OpenIddictAuthorizations", + maxLength: 450, + nullable: false, + oldClrType: typeof(string), + oldMaxLength: 450, + oldNullable: true); + } + } +} diff --git a/BTCPayServer.Data/Migrations/ApplicationDbContextModelSnapshot.cs b/BTCPayServer.Data/Migrations/ApplicationDbContextModelSnapshot.cs index 6aacb5462..e8ee803b4 100644 --- a/BTCPayServer.Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/BTCPayServer.Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -14,869 +14,869 @@ namespace BTCPayServer.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.1.11-servicing-32099"); + .HasAnnotation("ProductVersion", "2.1.14-servicing-32113"); modelBuilder.Entity("BTCPayServer.Data.AddressInvoiceData", b => - { - b.Property("Address") - .ValueGeneratedOnAdd(); + { + b.Property("Address") + .ValueGeneratedOnAdd(); - b.Property("CreatedTime"); + b.Property("CreatedTime"); - b.Property("InvoiceDataId"); + b.Property("InvoiceDataId"); - b.HasKey("Address"); + b.HasKey("Address"); - b.HasIndex("InvoiceDataId"); + b.HasIndex("InvoiceDataId"); - b.ToTable("AddressInvoices"); - }); + b.ToTable("AddressInvoices"); + }); modelBuilder.Entity("BTCPayServer.Data.APIKeyData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasMaxLength(50); + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(50); - b.Property("StoreId") - .HasMaxLength(50); + b.Property("StoreId") + .HasMaxLength(50); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("StoreId"); + b.HasIndex("StoreId"); - b.ToTable("ApiKeys"); - }); + b.ToTable("ApiKeys"); + }); modelBuilder.Entity("BTCPayServer.Data.AppData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("AppType"); + b.Property("AppType"); - b.Property("Created"); + b.Property("Created"); - b.Property("Name"); + b.Property("Name"); - b.Property("Settings"); + b.Property("Settings"); - b.Property("StoreDataId"); + b.Property("StoreDataId"); - b.Property("TagAllInvoices"); + b.Property("TagAllInvoices"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("StoreDataId"); + b.HasIndex("StoreDataId"); - b.ToTable("Apps"); - }); + b.ToTable("Apps"); + }); modelBuilder.Entity("BTCPayServer.Data.ApplicationUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount"); - b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); - b.Property("Email") - .HasMaxLength(256); + b.Property("Email") + .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd"); - b.Property("NormalizedEmail") - .HasMaxLength(256); + b.Property("NormalizedEmail") + .HasMaxLength(256); - b.Property("NormalizedUserName") - .HasMaxLength(256); + b.Property("NormalizedUserName") + .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed"); - b.Property("RequiresEmailConfirmation"); + b.Property("RequiresEmailConfirmation"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled"); - b.Property("UserName") - .HasMaxLength(256); + b.Property("UserName") + .HasMaxLength(256); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); + b.HasIndex("NormalizedEmail") + .HasName("EmailIndex"); - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasName("UserNameIndex"); + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasName("UserNameIndex"); - b.ToTable("AspNetUsers"); - }); + b.ToTable("AspNetUsers"); + }); modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdAuthorization", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ApplicationId"); + b.Property("ApplicationId"); - b.Property("ConcurrencyToken") - .IsConcurrencyToken() - .HasMaxLength(50); + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .HasMaxLength(50); - b.Property("Properties"); + b.Property("Properties"); - b.Property("Scopes"); + b.Property("Scopes"); - b.Property("Status") - .IsRequired() - .HasMaxLength(25); + b.Property("Status") + .IsRequired() + .HasMaxLength(25); - b.Property("Subject") - .IsRequired() - .HasMaxLength(450); + b.Property("Subject") + .HasMaxLength(450); - b.Property("Type") - .IsRequired() - .HasMaxLength(25); + b.Property("Type") + .IsRequired() + .HasMaxLength(25); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ApplicationId", "Status", "Subject", "Type"); + b.HasIndex("ApplicationId", "Status", "Subject", "Type"); - b.ToTable("OpenIddictAuthorizations"); - }); + b.ToTable("OpenIddictAuthorizations"); + }); modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdClient", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ApplicationUserId"); + b.Property("ApplicationUserId"); - b.Property("ClientId") - .IsRequired() - .HasMaxLength(100); + b.Property("ClientId") + .IsRequired() + .HasMaxLength(100); - b.Property("ClientSecret"); + b.Property("ClientSecret"); - b.Property("ConcurrencyToken") - .IsConcurrencyToken() - .HasMaxLength(50); + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .HasMaxLength(50); - b.Property("ConsentType"); + b.Property("ConsentType"); - b.Property("DisplayName"); + b.Property("DisplayName"); - b.Property("Permissions"); + b.Property("Permissions"); - b.Property("PostLogoutRedirectUris"); + b.Property("PostLogoutRedirectUris"); - b.Property("Properties"); + b.Property("Properties"); - b.Property("RedirectUris"); + b.Property("RedirectUris"); - b.Property("Type") - .IsRequired() - .HasMaxLength(25); + b.Property("Requirements"); - b.HasKey("Id"); + b.Property("Type") + .IsRequired() + .HasMaxLength(25); - b.HasIndex("ApplicationUserId"); + b.HasKey("Id"); - b.HasIndex("ClientId") - .IsUnique(); + b.HasIndex("ApplicationUserId"); - b.ToTable("OpenIddictApplications"); - }); + b.HasIndex("ClientId") + .IsUnique(); + + b.ToTable("OpenIddictApplications"); + }); modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ApplicationId"); + b.Property("ApplicationId"); - b.Property("AuthorizationId"); + b.Property("AuthorizationId"); - b.Property("ConcurrencyToken") - .IsConcurrencyToken() - .HasMaxLength(50); + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .HasMaxLength(50); - b.Property("CreationDate"); + b.Property("CreationDate"); - b.Property("ExpirationDate"); + b.Property("ExpirationDate"); - b.Property("Payload"); + b.Property("Payload"); - b.Property("Properties"); + b.Property("Properties"); - b.Property("ReferenceId") - .HasMaxLength(100); + b.Property("ReferenceId") + .HasMaxLength(100); - b.Property("Status") - .IsRequired() - .HasMaxLength(25); + b.Property("Status") + .IsRequired() + .HasMaxLength(25); - b.Property("Subject") - .IsRequired() - .HasMaxLength(450); + b.Property("Subject") + .HasMaxLength(450); - b.Property("Type") - .IsRequired() - .HasMaxLength(25); + b.Property("Type") + .IsRequired() + .HasMaxLength(25); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("AuthorizationId"); + b.HasIndex("AuthorizationId"); - b.HasIndex("ReferenceId") - .IsUnique(); + b.HasIndex("ReferenceId") + .IsUnique(); - b.HasIndex("ApplicationId", "Status", "Subject", "Type"); + b.HasIndex("ApplicationId", "Status", "Subject", "Type"); - b.ToTable("OpenIddictTokens"); - }); + b.ToTable("OpenIddictTokens"); + }); modelBuilder.Entity("BTCPayServer.Data.HistoricalAddressInvoiceData", b => - { - b.Property("InvoiceDataId"); + { + b.Property("InvoiceDataId"); - b.Property("Address"); + b.Property("Address"); - b.Property("Assigned"); + b.Property("Assigned"); - b.Property("CryptoCode"); + b.Property("CryptoCode"); - b.Property("UnAssigned"); + b.Property("UnAssigned"); - b.HasKey("InvoiceDataId", "Address"); + b.HasKey("InvoiceDataId", "Address"); - b.ToTable("HistoricalAddressInvoices"); - }); + b.ToTable("HistoricalAddressInvoices"); + }); modelBuilder.Entity("BTCPayServer.Data.InvoiceData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("Blob"); + b.Property("Blob"); - b.Property("Created"); + b.Property("Created"); - b.Property("CustomerEmail"); + b.Property("CustomerEmail"); - b.Property("ExceptionStatus"); + b.Property("ExceptionStatus"); - b.Property("ItemCode"); + b.Property("ItemCode"); - b.Property("OrderId"); + b.Property("OrderId"); - b.Property("Status"); + b.Property("Status"); - b.Property("StoreDataId"); + b.Property("StoreDataId"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("StoreDataId"); + b.HasIndex("StoreDataId"); - b.ToTable("Invoices"); - }); + b.ToTable("Invoices"); + }); modelBuilder.Entity("BTCPayServer.Data.InvoiceEventData", b => - { - b.Property("InvoiceDataId"); + { + b.Property("InvoiceDataId"); - b.Property("UniqueId"); + b.Property("UniqueId"); - b.Property("Message"); + b.Property("Message"); - b.Property("Timestamp"); + b.Property("Timestamp"); - b.HasKey("InvoiceDataId", "UniqueId"); + b.HasKey("InvoiceDataId", "UniqueId"); - b.ToTable("InvoiceEvents"); - }); + b.ToTable("InvoiceEvents"); + }); modelBuilder.Entity("BTCPayServer.Data.PairedSINData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("Label"); + b.Property("Label"); - b.Property("PairingTime"); + b.Property("PairingTime"); - b.Property("SIN"); + b.Property("SIN"); - b.Property("StoreDataId"); + b.Property("StoreDataId"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("SIN"); + b.HasIndex("SIN"); - b.HasIndex("StoreDataId"); + b.HasIndex("StoreDataId"); - b.ToTable("PairedSINData"); - }); + b.ToTable("PairedSINData"); + }); modelBuilder.Entity("BTCPayServer.Data.PairingCodeData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("DateCreated"); + b.Property("DateCreated"); - b.Property("Expiration"); + b.Property("Expiration"); - b.Property("Facade"); + b.Property("Facade"); - b.Property("Label"); + b.Property("Label"); - b.Property("SIN"); + b.Property("SIN"); - b.Property("StoreDataId"); + b.Property("StoreDataId"); - b.Property("TokenValue"); + b.Property("TokenValue"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("PairingCodes"); - }); + b.ToTable("PairingCodes"); + }); modelBuilder.Entity("BTCPayServer.Data.PaymentData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("Accounted"); + b.Property("Accounted"); - b.Property("Blob"); + b.Property("Blob"); - b.Property("InvoiceDataId"); + b.Property("InvoiceDataId"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("InvoiceDataId"); + b.HasIndex("InvoiceDataId"); - b.ToTable("Payments"); - }); + b.ToTable("Payments"); + }); modelBuilder.Entity("BTCPayServer.Data.PaymentRequestData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("Blob"); + b.Property("Blob"); - b.Property("Created") - .ValueGeneratedOnAdd() - .HasDefaultValue(new DateTimeOffset(new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0))); + b.Property("Created") + .ValueGeneratedOnAdd() + .HasDefaultValue(new DateTimeOffset(new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0))); - b.Property("Status"); + b.Property("Status"); - b.Property("StoreDataId"); + b.Property("StoreDataId"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Status"); + b.HasIndex("Status"); - b.HasIndex("StoreDataId"); + b.HasIndex("StoreDataId"); - b.ToTable("PaymentRequests"); - }); + b.ToTable("PaymentRequests"); + }); modelBuilder.Entity("BTCPayServer.Data.PendingInvoiceData", b => - { - b.Property("Id"); + { + b.Property("Id"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("PendingInvoices"); - }); + b.ToTable("PendingInvoices"); + }); modelBuilder.Entity("BTCPayServer.Data.RefundAddressesData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("Blob"); + b.Property("Blob"); - b.Property("InvoiceDataId"); + b.Property("InvoiceDataId"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("InvoiceDataId"); + b.HasIndex("InvoiceDataId"); - b.ToTable("RefundAddresses"); - }); + b.ToTable("RefundAddresses"); + }); modelBuilder.Entity("BTCPayServer.Data.SettingData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("Value"); + b.Property("Value"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Settings"); - }); + b.ToTable("Settings"); + }); modelBuilder.Entity("BTCPayServer.Data.StoreData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("DefaultCrypto"); + b.Property("DefaultCrypto"); - b.Property("DerivationStrategies"); + b.Property("DerivationStrategies"); - b.Property("DerivationStrategy"); + b.Property("DerivationStrategy"); - b.Property("SpeedPolicy"); + b.Property("SpeedPolicy"); - b.Property("StoreBlob"); + b.Property("StoreBlob"); - b.Property("StoreCertificate"); + b.Property("StoreCertificate"); - b.Property("StoreName"); + b.Property("StoreName"); - b.Property("StoreWebsite"); + b.Property("StoreWebsite"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Stores"); - }); + b.ToTable("Stores"); + }); modelBuilder.Entity("BTCPayServer.Data.StoredFile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ApplicationUserId"); + b.Property("ApplicationUserId"); - b.Property("FileName"); + b.Property("FileName"); - b.Property("StorageFileName"); + b.Property("StorageFileName"); - b.Property("Timestamp"); + b.Property("Timestamp"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ApplicationUserId"); + b.HasIndex("ApplicationUserId"); - b.ToTable("Files"); - }); + b.ToTable("Files"); + }); modelBuilder.Entity("BTCPayServer.Data.U2FDevice", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ApplicationUserId"); + b.Property("ApplicationUserId"); - b.Property("AttestationCert") - .IsRequired(); + b.Property("AttestationCert") + .IsRequired(); - b.Property("Counter"); + b.Property("Counter"); - b.Property("KeyHandle") - .IsRequired(); + b.Property("KeyHandle") + .IsRequired(); - b.Property("Name"); + b.Property("Name"); - b.Property("PublicKey") - .IsRequired(); + b.Property("PublicKey") + .IsRequired(); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ApplicationUserId"); + b.HasIndex("ApplicationUserId"); - b.ToTable("U2FDevices"); - }); + b.ToTable("U2FDevices"); + }); modelBuilder.Entity("BTCPayServer.Data.UserStore", b => - { - b.Property("ApplicationUserId"); + { + b.Property("ApplicationUserId"); - b.Property("StoreDataId"); + b.Property("StoreDataId"); - b.Property("Role"); + b.Property("Role"); - b.HasKey("ApplicationUserId", "StoreDataId"); + b.HasKey("ApplicationUserId", "StoreDataId"); - b.HasIndex("StoreDataId"); + b.HasIndex("StoreDataId"); - b.ToTable("UserStore"); - }); + b.ToTable("UserStore"); + }); modelBuilder.Entity("BTCPayServer.Data.WalletData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("Blob"); + b.Property("Blob"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Wallets"); - }); + b.ToTable("Wallets"); + }); modelBuilder.Entity("BTCPayServer.Data.WalletTransactionData", b => - { - b.Property("WalletDataId"); + { + b.Property("WalletDataId"); - b.Property("TransactionId"); + b.Property("TransactionId"); - b.Property("Blob"); + b.Property("Blob"); - b.Property("Labels"); + b.Property("Labels"); - b.HasKey("WalletDataId", "TransactionId"); + b.HasKey("WalletDataId", "TransactionId"); - b.ToTable("WalletTransactions"); - }); + b.ToTable("WalletTransactions"); + }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); - b.Property("Name") - .HasMaxLength(256); + b.Property("Name") + .HasMaxLength(256); - b.Property("NormalizedName") - .HasMaxLength(256); + b.Property("NormalizedName") + .HasMaxLength(256); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("NormalizedName") - .IsUnique() - .HasName("RoleNameIndex"); + b.HasIndex("NormalizedName") + .IsUnique() + .HasName("RoleNameIndex"); - b.ToTable("AspNetRoles"); - }); + b.ToTable("AspNetRoles"); + }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ClaimType"); + b.Property("ClaimType"); - b.Property("ClaimValue"); + b.Property("ClaimValue"); - b.Property("RoleId") - .IsRequired(); + b.Property("RoleId") + .IsRequired(); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("RoleId"); + b.HasIndex("RoleId"); - b.ToTable("AspNetRoleClaims"); - }); + b.ToTable("AspNetRoleClaims"); + }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ClaimType"); + b.Property("ClaimType"); - b.Property("ClaimValue"); + b.Property("ClaimValue"); - b.Property("UserId") - .IsRequired(); + b.Property("UserId") + .IsRequired(); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("UserId"); + b.HasIndex("UserId"); - b.ToTable("AspNetUserClaims"); - }); + b.ToTable("AspNetUserClaims"); + }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider"); + { + b.Property("LoginProvider"); - b.Property("ProviderKey"); + b.Property("ProviderKey"); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName"); - b.Property("UserId") - .IsRequired(); + b.Property("UserId") + .IsRequired(); - b.HasKey("LoginProvider", "ProviderKey"); + b.HasKey("LoginProvider", "ProviderKey"); - b.HasIndex("UserId"); + b.HasIndex("UserId"); - b.ToTable("AspNetUserLogins"); - }); + b.ToTable("AspNetUserLogins"); + }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId"); + { + b.Property("UserId"); - b.Property("RoleId"); + b.Property("RoleId"); - b.HasKey("UserId", "RoleId"); + b.HasKey("UserId", "RoleId"); - b.HasIndex("RoleId"); + b.HasIndex("RoleId"); - b.ToTable("AspNetUserRoles"); - }); + b.ToTable("AspNetUserRoles"); + }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId"); + { + b.Property("UserId"); - b.Property("LoginProvider"); + b.Property("LoginProvider"); - b.Property("Name"); + b.Property("Name"); - b.Property("Value"); + b.Property("Value"); - b.HasKey("UserId", "LoginProvider", "Name"); + b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AspNetUserTokens"); - }); + b.ToTable("AspNetUserTokens"); + }); modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ConcurrencyToken") - .IsConcurrencyToken() - .HasMaxLength(50); + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .HasMaxLength(50); - b.Property("Description"); + b.Property("Description"); - b.Property("DisplayName"); + b.Property("DisplayName"); - b.Property("Name") - .IsRequired() - .HasMaxLength(200); + b.Property("Name") + .IsRequired() + .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties"); - b.Property("Resources"); + b.Property("Resources"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("Name") + .IsUnique(); - b.ToTable("OpenIddictScopes"); - }); + b.ToTable("OpenIddictScopes"); + }); modelBuilder.Entity("BTCPayServer.Data.AddressInvoiceData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("AddressInvoices") - .HasForeignKey("InvoiceDataId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") + .WithMany("AddressInvoices") + .HasForeignKey("InvoiceDataId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.APIKeyData", b => - { - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("APIKeys") - .HasForeignKey("StoreId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.StoreData", "StoreData") + .WithMany("APIKeys") + .HasForeignKey("StoreId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.AppData", b => - { - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("Apps") - .HasForeignKey("StoreDataId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.StoreData", "StoreData") + .WithMany("Apps") + .HasForeignKey("StoreDataId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdAuthorization", b => - { - b.HasOne("BTCPayServer.Data.BTCPayOpenIdClient", "Application") - .WithMany("Authorizations") - .HasForeignKey("ApplicationId"); - }); + { + b.HasOne("BTCPayServer.Data.BTCPayOpenIdClient", "Application") + .WithMany("Authorizations") + .HasForeignKey("ApplicationId"); + }); modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdClient", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") - .WithMany("OpenIdClients") - .HasForeignKey("ApplicationUserId"); - }); + { + b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") + .WithMany("OpenIdClients") + .HasForeignKey("ApplicationUserId"); + }); modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdToken", b => - { - b.HasOne("BTCPayServer.Data.BTCPayOpenIdClient", "Application") - .WithMany("Tokens") - .HasForeignKey("ApplicationId"); + { + b.HasOne("BTCPayServer.Data.BTCPayOpenIdClient", "Application") + .WithMany("Tokens") + .HasForeignKey("ApplicationId"); - b.HasOne("BTCPayServer.Data.BTCPayOpenIdAuthorization", "Authorization") - .WithMany("Tokens") - .HasForeignKey("AuthorizationId"); - }); + b.HasOne("BTCPayServer.Data.BTCPayOpenIdAuthorization", "Authorization") + .WithMany("Tokens") + .HasForeignKey("AuthorizationId"); + }); modelBuilder.Entity("BTCPayServer.Data.HistoricalAddressInvoiceData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("HistoricalAddressInvoices") - .HasForeignKey("InvoiceDataId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") + .WithMany("HistoricalAddressInvoices") + .HasForeignKey("InvoiceDataId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.InvoiceData", b => - { - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("Invoices") - .HasForeignKey("StoreDataId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.StoreData", "StoreData") + .WithMany("Invoices") + .HasForeignKey("StoreDataId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.InvoiceEventData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("Events") - .HasForeignKey("InvoiceDataId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") + .WithMany("Events") + .HasForeignKey("InvoiceDataId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.PairedSINData", b => - { - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("PairedSINs") - .HasForeignKey("StoreDataId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.StoreData", "StoreData") + .WithMany("PairedSINs") + .HasForeignKey("StoreDataId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.PaymentData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("Payments") - .HasForeignKey("InvoiceDataId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") + .WithMany("Payments") + .HasForeignKey("InvoiceDataId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.PaymentRequestData", b => - { - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("PaymentRequests") - .HasForeignKey("StoreDataId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.StoreData", "StoreData") + .WithMany("PaymentRequests") + .HasForeignKey("StoreDataId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.PendingInvoiceData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("PendingInvoices") - .HasForeignKey("Id") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") + .WithMany("PendingInvoices") + .HasForeignKey("Id") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.RefundAddressesData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("RefundAddresses") - .HasForeignKey("InvoiceDataId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") + .WithMany("RefundAddresses") + .HasForeignKey("InvoiceDataId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.StoredFile", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") - .WithMany("StoredFiles") - .HasForeignKey("ApplicationUserId"); - }); + { + b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") + .WithMany("StoredFiles") + .HasForeignKey("ApplicationUserId"); + }); modelBuilder.Entity("BTCPayServer.Data.U2FDevice", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") - .WithMany("U2FDevices") - .HasForeignKey("ApplicationUserId"); - }); + { + b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") + .WithMany("U2FDevices") + .HasForeignKey("ApplicationUserId"); + }); modelBuilder.Entity("BTCPayServer.Data.UserStore", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") - .WithMany("UserStores") - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Cascade); + { + b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") + .WithMany("UserStores") + .HasForeignKey("ApplicationUserId") + .OnDelete(DeleteBehavior.Cascade); - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("UserStores") - .HasForeignKey("StoreDataId") - .OnDelete(DeleteBehavior.Cascade); - }); + b.HasOne("BTCPayServer.Data.StoreData", "StoreData") + .WithMany("UserStores") + .HasForeignKey("StoreDataId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("BTCPayServer.Data.WalletTransactionData", b => - { - b.HasOne("BTCPayServer.Data.WalletData", "WalletData") - .WithMany("WalletTransactions") - .HasForeignKey("WalletDataId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.WalletData", "WalletData") + .WithMany("WalletTransactions") + .HasForeignKey("WalletDataId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.ApplicationUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.ApplicationUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); - b.HasOne("BTCPayServer.Data.ApplicationUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + b.HasOne("BTCPayServer.Data.ApplicationUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + { + b.HasOne("BTCPayServer.Data.ApplicationUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); #pragma warning restore 612, 618 } } diff --git a/BTCPayServer.Rating/BTCPayServer.Rating.csproj b/BTCPayServer.Rating/BTCPayServer.Rating.csproj index aa2a130d5..254d8f02b 100644 --- a/BTCPayServer.Rating/BTCPayServer.Rating.csproj +++ b/BTCPayServer.Rating/BTCPayServer.Rating.csproj @@ -9,7 +9,7 @@ - + diff --git a/BTCPayServer.Tests/AuthenticationTests.cs b/BTCPayServer.Tests/AuthenticationTests.cs index 554730a6e..886702b69 100644 --- a/BTCPayServer.Tests/AuthenticationTests.cs +++ b/BTCPayServer.Tests/AuthenticationTests.cs @@ -249,7 +249,7 @@ namespace BTCPayServer.Tests Assert.True(response.IsSuccessStatusCode); string content = await response.Content.ReadAsStringAsync(); - var result = JObject.Parse(content).ToObject(); + var result = System.Text.Json.JsonSerializer.Deserialize(content); await TestApiAgainstAccessToken(result.AccessToken, tester, user); @@ -289,7 +289,7 @@ namespace BTCPayServer.Tests Assert.True(response.IsSuccessStatusCode); string content = await response.Content.ReadAsStringAsync(); - var result = JObject.Parse(content).ToObject(); + var result = System.Text.Json.JsonSerializer.Deserialize(content); Assert.NotEmpty(result.AccessToken); Assert.Null(result.Error); return result.AccessToken; @@ -330,7 +330,7 @@ namespace BTCPayServer.Tests Assert.True(response.IsSuccessStatusCode); string content = await response.Content.ReadAsStringAsync(); - var result = JObject.Parse(content).ToObject(); + var result = System.Text.Json.JsonSerializer.Deserialize(content); Assert.NotEmpty(result.AccessToken); Assert.Null(result.Error); return result.AccessToken; @@ -371,7 +371,7 @@ namespace BTCPayServer.Tests Assert.True(response.IsSuccessStatusCode); string content = await response.Content.ReadAsStringAsync(); - var result = JObject.Parse(content).ToObject(); + var result = System.Text.Json.JsonSerializer.Deserialize(content); Assert.NotEmpty(result.AccessToken); Assert.Null(result.Error); return result.AccessToken; diff --git a/BTCPayServer.Tests/BTCPayServer.Tests.csproj b/BTCPayServer.Tests/BTCPayServer.Tests.csproj index 468bd9bdd..285a0067b 100644 --- a/BTCPayServer.Tests/BTCPayServer.Tests.csproj +++ b/BTCPayServer.Tests/BTCPayServer.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp3.1 $(TargetFrameworkOverride) false NU1701,CA1816,CA1308,CA1810,CA2208 diff --git a/BTCPayServer.Tests/Dockerfile b/BTCPayServer.Tests/Dockerfile index 8b3b4488b..f7d830fbb 100644 --- a/BTCPayServer.Tests/Dockerfile +++ b/BTCPayServer.Tests/Dockerfile @@ -1,8 +1,7 @@ -FROM mcr.microsoft.com/dotnet/core/sdk:2.1.607-alpine3.9 AS builder -ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT false -RUN apk add --no-cache icu-libs -ENV LC_ALL en_US.UTF-8 -ENV LANG en_US.UTF-8 +FROM mcr.microsoft.com/dotnet/core/sdk:3.1.100 AS builder + +RUN apt-get update && apt-get install -y --no-install-recommends chromium-driver \ + && rm -rf /var/lib/apt/lists/* WORKDIR /source COPY nuget.config nuget.config @@ -11,15 +10,12 @@ COPY BTCPayServer/BTCPayServer.csproj BTCPayServer/BTCPayServer.csproj COPY BTCPayServer.Common/BTCPayServer.Common.csproj BTCPayServer.Common/BTCPayServer.Common.csproj COPY BTCPayServer.Rating/BTCPayServer.Rating.csproj BTCPayServer.Rating/BTCPayServer.Rating.csproj COPY BTCPayServer.Data/BTCPayServer.Data.csproj BTCPayServer.Data/BTCPayServer.Data.csproj -COPY BTCPayServer.Tests/BTCPayServer.Tests.csproj BTCPayServer.Tests/BTCPayServer.Tests.csproj -RUN dotnet restore BTCPayServer.Tests/BTCPayServer.Tests.csproj - -ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT false - -ENV LC_ALL en_US.UTF-8 -ENV LANG en_US.UTF-8 - -RUN apk add --no-cache chromium chromium-chromedriver icu-libs +RUN cd BTCPayServer && dotnet restore +COPY BTCPayServer.Common/. BTCPayServer.Common/. +COPY BTCPayServer.Rating/. BTCPayServer.Rating/. +COPY BTCPayServer.Data/. BTCPayServer.Data/. +COPY BTCPayServer/. BTCPayServer/. +COPY Build/Version.csproj Build/Version.csproj ENV SCREEN_HEIGHT 600 \ SCREEN_WIDTH 1200 diff --git a/BTCPayServer.Tests/docker-entrypoint.sh b/BTCPayServer.Tests/docker-entrypoint.sh index afc061905..5f11b488c 100755 --- a/BTCPayServer.Tests/docker-entrypoint.sh +++ b/BTCPayServer.Tests/docker-entrypoint.sh @@ -2,8 +2,8 @@ set -e FILTERS=" " -if [[ "$TEST_FILTERS" ]]; then +if [ ! -z "$TEST_FILTERS" ]; then FILTERS="--filter $TEST_FILTERS" fi -dotnet test $FILTERS --no-build -v n +dotnet test $FILTERS --no-build -v n < /dev/null diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index ceb719459..bbdfe3ebe 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -65,12 +65,13 @@ - - - + + + + diff --git a/BTCPayServer/Controllers/AuthorizationController.cs b/BTCPayServer/Controllers/AuthorizationController.cs index 73adc68da..f0b37680d 100644 --- a/BTCPayServer/Controllers/AuthorizationController.cs +++ b/BTCPayServer/Controllers/AuthorizationController.cs @@ -126,7 +126,7 @@ namespace BTCPayServer.Controllers { var application = await _applicationManager.FindByClientIdAsync(request.ClientId); var authorization = await _authorizationManager.CreateAsync(User, user.Id, application.Id, - type, principal.GetScopes().ToImmutableArray()); + type, principal.GetScopes()); principal.SetInternalAuthorizationId(authorization.Id); } diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs index 953810a99..c6b795d64 100644 --- a/BTCPayServer/Hosting/Startup.cs +++ b/BTCPayServer/Hosting/Startup.cs @@ -80,6 +80,9 @@ namespace BTCPayServer.Hosting }) #if !NETCOREAPP21 .AddNewtonsoftJson() +#if DEBUG + .AddRazorRuntimeCompilation() +#endif #endif .AddControllersAsServices(); services.TryAddScoped(); @@ -161,8 +164,7 @@ namespace BTCPayServer.Hosting .EnableStatusCodePagesIntegration() .EnableAuthorizationEndpointPassthrough() .EnableLogoutEndpointPassthrough() - .EnableTokenEndpointPassthrough() - .EnableRequestCaching() + .EnableAuthorizationEndpointCaching() .DisableTransportSecurityRequirement(); // Enable the token endpoint (required to use the password flow). diff --git a/BTCPayServer/Security/OpenId/ClientCredentialsGrantTypeEventHandler.cs b/BTCPayServer/Security/OpenId/ClientCredentialsGrantTypeEventHandler.cs index 71f00aeae..af598a44a 100644 --- a/BTCPayServer/Security/OpenId/ClientCredentialsGrantTypeEventHandler.cs +++ b/BTCPayServer/Security/OpenId/ClientCredentialsGrantTypeEventHandler.cs @@ -56,7 +56,6 @@ namespace BTCPayServer.Security.OpenId var user = await _userManager.FindByIdAsync(application.ApplicationUserId); context.Principal = await CreateClaimsPrincipalAsync(request, user); - notification.HandleAuthentication(); } } } diff --git a/BTCPayServer/Security/OpenId/OpenIdExtensions.cs b/BTCPayServer/Security/OpenId/OpenIdExtensions.cs index c37cce64a..12ef9e83b 100644 --- a/BTCPayServer/Security/OpenId/OpenIdExtensions.cs +++ b/BTCPayServer/Security/OpenId/OpenIdExtensions.cs @@ -16,7 +16,7 @@ namespace BTCPayServer.Security.OpenId { public static class OpenIdExtensions { - public static ImmutableHashSet Restrict(this ImmutableHashSet scopes, ClaimsPrincipal claimsPrincipal) + public static ImmutableHashSet Restrict(this ImmutableArray scopes, ClaimsPrincipal claimsPrincipal) { HashSet restricted = new HashSet(); foreach (var scope in scopes) @@ -80,10 +80,9 @@ namespace BTCPayServer.Security.OpenId { var authorizations = await authorizationManager.ListAsync(queryable => queryable.Where(authorization => - authorization.Subject.Equals(userId, StringComparison.OrdinalIgnoreCase) && - applicationId.Equals(authorization.Application.Id, StringComparison.OrdinalIgnoreCase) && - authorization.Status.Equals(OpenIddictConstants.Statuses.Valid, - StringComparison.OrdinalIgnoreCase))).ToArrayAsync(); + authorization.Subject == userId && + authorization.Application.Id == applicationId && + authorization.Status == OpenIddictConstants.Statuses.Valid)).ToArrayAsync(); if (authorizations.Length > 0) { diff --git a/BTCPayServer/Security/OpenId/OpenIdGrantHandlerCheckCanSignIn.cs b/BTCPayServer/Security/OpenId/OpenIdGrantHandlerCheckCanSignIn.cs index cf502bc66..0ed4bac9b 100644 --- a/BTCPayServer/Security/OpenId/OpenIdGrantHandlerCheckCanSignIn.cs +++ b/BTCPayServer/Security/OpenId/OpenIdGrantHandlerCheckCanSignIn.cs @@ -66,7 +66,6 @@ namespace BTCPayServer.Security.OpenId } notification.Principal = await this.CreateClaimsPrincipalAsync(request, user); - notification.HandleAuthentication(); } } } diff --git a/BTCPayServer/Security/OpenId/PasswordGrantTypeEventHandler.cs b/BTCPayServer/Security/OpenId/PasswordGrantTypeEventHandler.cs index 597e2924c..b28018b4e 100644 --- a/BTCPayServer/Security/OpenId/PasswordGrantTypeEventHandler.cs +++ b/BTCPayServer/Security/OpenId/PasswordGrantTypeEventHandler.cs @@ -60,7 +60,6 @@ namespace BTCPayServer.Security.OpenId } notification.Principal = await CreateClaimsPrincipalAsync(request, user); - notification.HandleAuthentication(); } } } diff --git a/Build/Common.csproj b/Build/Common.csproj index e7fcac29d..126a338d9 100644 --- a/Build/Common.csproj +++ b/Build/Common.csproj @@ -1,9 +1,9 @@ - netcoreapp2.1 + netcoreapp3.1 $(TargetFrameworkOverride) NU1701,CA1816,CA1308,CA1810,CA2208 - 7.3 + 8.0 $(DefineConstants);NETCOREAPP21 diff --git a/amd64.Dockerfile b/amd64.Dockerfile index b4fa53386..5d06c2a4b 100644 --- a/amd64.Dockerfile +++ b/amd64.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/core/sdk:2.1.607 AS builder +FROM mcr.microsoft.com/dotnet/core/sdk:3.1.100 AS builder WORKDIR /source COPY nuget.config nuget.config COPY Build/Common.csproj Build/Common.csproj @@ -14,16 +14,16 @@ COPY BTCPayServer/. BTCPayServer/. COPY Build/Version.csproj Build/Version.csproj RUN cd BTCPayServer && dotnet publish --output /app/ --configuration Release -FROM mcr.microsoft.com/dotnet/core/aspnet:2.1.14-alpine3.9 +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.0-buster-slim -ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT false -RUN apk add --no-cache icu-libs openssh-keygen +RUN apt-get update && apt-get install -y --no-install-recommends iproute2 openssh-client \ + && rm -rf /var/lib/apt/lists/* ENV LC_ALL en_US.UTF-8 ENV LANG en_US.UTF-8 +WORKDIR /datadir WORKDIR /app -RUN mkdir /datadir ENV BTCPAY_DATADIR=/datadir VOLUME /datadir diff --git a/arm32v7.Dockerfile b/arm32v7.Dockerfile index e888bb0ac..10eae21da 100644 --- a/arm32v7.Dockerfile +++ b/arm32v7.Dockerfile @@ -1,5 +1,5 @@ # This is a manifest image, will pull the image with the same arch as the builder machine -FROM mcr.microsoft.com/dotnet/core/sdk:2.1.607 AS builder +FROM mcr.microsoft.com/dotnet/core/sdk:3.1.100 AS builder RUN apt-get update \ && apt-get install -qq --no-install-recommends qemu qemu-user-static qemu-user binfmt-support @@ -19,7 +19,7 @@ COPY Build/Version.csproj Build/Version.csproj RUN cd BTCPayServer && dotnet publish --output /app/ --configuration Release # Force the builder machine to take make an arm runtime image. This is fine as long as the builder does not run any program -FROM mcr.microsoft.com/dotnet/core/aspnet:2.1.14-stretch-slim-arm32v7 +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.0-buster-slim-arm32v7 COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static RUN apt-get update && apt-get install -y --no-install-recommends iproute2 openssh-client \ && rm -rf /var/lib/apt/lists/*