From 9faa67e2b7857ff79f571f8a785a2c9df136c341 Mon Sep 17 00:00:00 2001 From: Zoltan Juhasz Date: Sun, 23 Oct 2022 12:01:14 +0200 Subject: [PATCH] Project startup improvements, add more content to README.md file --- .../Forge.Yoda.Services.Authentication.csproj | 5 +- ....cs => 20221023095742_Initial.Designer.cs} | 176 ++++++++---------- ...6_Initial.cs => 20221023095742_Initial.cs} | 4 - .../DatabaseContextModelSnapshot.cs | 174 ++++++++--------- README.md | 20 ++ 5 files changed, 186 insertions(+), 193 deletions(-) rename Forge.Yoda.Services.Authentication/Migrations/{20221005133116_Initial.Designer.cs => 20221023095742_Initial.Designer.cs} (95%) rename Forge.Yoda.Services.Authentication/Migrations/{20221005133116_Initial.cs => 20221023095742_Initial.cs} (96%) diff --git a/Forge.Yoda.Services.Authentication/Forge.Yoda.Services.Authentication.csproj b/Forge.Yoda.Services.Authentication/Forge.Yoda.Services.Authentication.csproj index f3f6179..be827bf 100644 --- a/Forge.Yoda.Services.Authentication/Forge.Yoda.Services.Authentication.csproj +++ b/Forge.Yoda.Services.Authentication/Forge.Yoda.Services.Authentication.csproj @@ -42,8 +42,7 @@ - - + + diff --git a/Forge.Yoda.Services.Authentication/Migrations/20221005133116_Initial.Designer.cs b/Forge.Yoda.Services.Authentication/Migrations/20221023095742_Initial.Designer.cs similarity index 95% rename from Forge.Yoda.Services.Authentication/Migrations/20221005133116_Initial.Designer.cs rename to Forge.Yoda.Services.Authentication/Migrations/20221023095742_Initial.Designer.cs index c733318..4e1a2d3 100644 --- a/Forge.Yoda.Services.Authentication/Migrations/20221005133116_Initial.Designer.cs +++ b/Forge.Yoda.Services.Authentication/Migrations/20221023095742_Initial.Designer.cs @@ -12,18 +12,98 @@ namespace Forge.Yoda.Services.Authentication.Migrations { [DbContext(typeof(DatabaseContext))] - [Migration("20221005133116_Initial")] + [Migration("20221023095742_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.9") + .HasAnnotation("ProductVersion", "6.0.10") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + modelBuilder.Entity("Forge.Yoda.Services.Authentication.Database.User", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("Givenname") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsAccountDisabled") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("Role") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("Surname") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") @@ -157,98 +237,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("AspNetUserTokens", (string)null); }); - modelBuilder.Entity("Forge.Yoda.Services.Authentication.Database.User", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Customer_Number") - .HasColumnType("int"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Givenname") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsAccountDisabled") - .HasColumnType("bit"); - - b.Property("IsExternalAccount") - .HasColumnType("bit"); - - b.Property("IsExternalAccountDisabled") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("Role") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Supplier_Number") - .HasColumnType("int"); - - b.Property("Surname") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) diff --git a/Forge.Yoda.Services.Authentication/Migrations/20221005133116_Initial.cs b/Forge.Yoda.Services.Authentication/Migrations/20221023095742_Initial.cs similarity index 96% rename from Forge.Yoda.Services.Authentication/Migrations/20221005133116_Initial.cs rename to Forge.Yoda.Services.Authentication/Migrations/20221023095742_Initial.cs index 488e485..8b44875 100644 --- a/Forge.Yoda.Services.Authentication/Migrations/20221005133116_Initial.cs +++ b/Forge.Yoda.Services.Authentication/Migrations/20221023095742_Initial.cs @@ -31,11 +31,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Surname = table.Column(type: "nvarchar(max)", nullable: false), Givenname = table.Column(type: "nvarchar(max)", nullable: false), IsAccountDisabled = table.Column(type: "bit", nullable: false), - IsExternalAccount = table.Column(type: "bit", nullable: false), - IsExternalAccountDisabled = table.Column(type: "bit", nullable: false), Role = table.Column(type: "nvarchar(max)", nullable: false), - Supplier_Number = table.Column(type: "int", nullable: false), - Customer_Number = table.Column(type: "int", nullable: false), UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), diff --git a/Forge.Yoda.Services.Authentication/Migrations/DatabaseContextModelSnapshot.cs b/Forge.Yoda.Services.Authentication/Migrations/DatabaseContextModelSnapshot.cs index d0f3a1a..963e8c2 100644 --- a/Forge.Yoda.Services.Authentication/Migrations/DatabaseContextModelSnapshot.cs +++ b/Forge.Yoda.Services.Authentication/Migrations/DatabaseContextModelSnapshot.cs @@ -17,11 +17,91 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.9") + .HasAnnotation("ProductVersion", "6.0.10") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + modelBuilder.Entity("Forge.Yoda.Services.Authentication.Database.User", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("Givenname") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsAccountDisabled") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("Role") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("Surname") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") @@ -155,98 +235,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("AspNetUserTokens", (string)null); }); - modelBuilder.Entity("Forge.Yoda.Services.Authentication.Database.User", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Customer_Number") - .HasColumnType("int"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Givenname") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsAccountDisabled") - .HasColumnType("bit"); - - b.Property("IsExternalAccount") - .HasColumnType("bit"); - - b.Property("IsExternalAccountDisabled") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("Role") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Supplier_Number") - .HasColumnType("int"); - - b.Property("Surname") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) diff --git a/README.md b/README.md index 49d8b85..2b907dd 100644 --- a/README.md +++ b/README.md @@ -69,3 +69,23 @@ I have created examples for the implementations for the following client types: These projects are WASM / Blazor hybrid projects, so the UI is a web site (HTML, CSS, JS). Everything is hosted in a browser as a Web Assembly content. However in the desktop applications (WinForms, WPF, MAUI Windows) require a WebView to show and run the WASM. + + +## Configuration of Forge.Yoda.Services.Authentication service +Open the Database\DatabaseContext.cs and appsettings.json files. Modify the credentials as it is necessary on your side, create your own database. +In the developer command prompt or in Package Manager Console (Tools -> NuGet Package Manager -> Package Manager Console) initialize your database. +Select "Default project" in the window as "Forge.Yoda.Services.Authentication", than type in the command prompt: + +Update-Database + +If your configuration and database are properly pre-configured, the database schema will be created. + + +## Startup +It is recommended to configure the solution startup preferences. Right click on the solution and select "Set Startup Projects..." from the context menu. Choose the "Multiple startup projects", +and always set the Action to "Start" for the project "Forge.Yoda.Services.Authentication". You can do the same for the "client" applications as you requested, one or more... + +Forge.Yoda.Services.Authentication service will create the administrative account for the first time. For the default set credentials, check the source code at Codes\InititalizationAtStartup.cs file. + +When start the solution, the one of the app windows will be a browser with a SwaggerUI for the Authentication service. This UI is applied for testing purpose and it is available in development mode. +The other windows are depends on your project startup settings.