├── BlazorAppWASM ├── wwwroot │ ├── favicon.png │ ├── icon-192.png │ ├── sample-data │ │ └── weather.json │ ├── index.html │ └── css │ │ └── app.css ├── Authentications │ ├── UserInfo.cs │ ├── LoginModel.cs │ └── CookieAuthenticationStateProvider.cs ├── Pages │ ├── Counter.razor │ ├── Home.razor │ └── Weather.razor ├── _Imports.razor ├── Layout │ ├── MainLayout.razor │ ├── NavMenu.razor │ ├── MainLayout.razor.css │ └── NavMenu.razor.css ├── BlazorAppWASM.csproj ├── Program.cs ├── App.razor └── Properties │ └── launchSettings.json ├── DotNet8CookieAuthenticationInBlazorWasm ├── appsettings.Development.json ├── DotNet8CookieAuthenticationInBlazorWasm.http ├── appsettings.json ├── AppDbContext.cs ├── WeatherForecast.cs ├── DotNet8CookieAuthenticationInBlazorWasm.csproj ├── Properties │ └── launchSettings.json ├── Controllers │ └── WeatherForecastController.cs ├── Program.cs └── Migrations │ ├── 20231121152331_First.cs │ ├── AppDbContextModelSnapshot.cs │ └── 20231121152331_First.Designer.cs ├── README.md ├── DotNet8CookieAuthenticationInBlazorWasmSolution.sln ├── .gitattributes └── .gitignore /BlazorAppWASM/wwwroot/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netcode-Hub/DotNet8CookieAuthenticationInBlazorWasmSolution/HEAD/BlazorAppWASM/wwwroot/favicon.png -------------------------------------------------------------------------------- /BlazorAppWASM/wwwroot/icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netcode-Hub/DotNet8CookieAuthenticationInBlazorWasmSolution/HEAD/BlazorAppWASM/wwwroot/icon-192.png -------------------------------------------------------------------------------- /BlazorAppWASM/Authentications/UserInfo.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorAppWASM.Authentications 2 | { 3 | public class UserInfo 4 | { 5 | public string? Email { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /BlazorAppWASM/Authentications/LoginModel.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorAppWASM.Authentications 2 | { 3 | public class LoginModel 4 | { 5 | public string? Email { get; set; } 6 | public string? Password { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/DotNet8CookieAuthenticationInBlazorWasm.http: -------------------------------------------------------------------------------- 1 | @DotNet8CookieAuthenticationInBlazorWasm_HostAddress = http://localhost:5200 2 | 3 | GET {{DotNet8CookieAuthenticationInBlazorWasm_HostAddress}}/weatherforecast/ 4 | Accept: application/json 5 | 6 | ### 7 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "DefaultConnection": "Server=(local); Database=DemoCookieIdentity; Trusted_Connection=True; TrustServerCertificate=True;" 4 | }, 5 | "Logging": { 6 | "LogLevel": { 7 | "Default": "Information", 8 | "Microsoft.AspNetCore": "Warning" 9 | } 10 | }, 11 | "AllowedHosts": "*" 12 | } 13 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/AppDbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore; 3 | 4 | namespace DotNet8CookieAuthenticationInBlazorWasm 5 | { 6 | public class AppDbContext : IdentityDbContext 7 | { 8 | public AppDbContext(DbContextOptions options) : base(options) 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | namespace DotNet8CookieAuthenticationInBlazorWasm 2 | { 3 | public class WeatherForecast 4 | { 5 | public DateOnly Date { get; set; } 6 | 7 | public int TemperatureC { get; set; } 8 | 9 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 10 | 11 | public string? Summary { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorAppWASM/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 | Counter 4 | 5 |

Counter

6 | 7 |

Current count: @currentCount

8 | 9 | 10 | 11 | @code { 12 | private int currentCount = 0; 13 | 14 | private void IncrementCount() 15 | { 16 | currentCount++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BlazorAppWASM/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using Microsoft.AspNetCore.Components.Web.Virtualization 7 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 8 | @using Microsoft.JSInterop 9 | @using BlazorAppWASM 10 | @using BlazorAppWASM.Layout 11 | -------------------------------------------------------------------------------- /BlazorAppWASM/Layout/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 |
3 | 6 | 7 |
8 |
9 | About 10 |
11 | 12 |
13 | @Body 14 |
15 |
16 |
17 | -------------------------------------------------------------------------------- /BlazorAppWASM/wwwroot/sample-data/weather.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "date": "2022-01-06", 4 | "temperatureC": 1, 5 | "summary": "Freezing" 6 | }, 7 | { 8 | "date": "2022-01-07", 9 | "temperatureC": 14, 10 | "summary": "Bracing" 11 | }, 12 | { 13 | "date": "2022-01-08", 14 | "temperatureC": -13, 15 | "summary": "Freezing" 16 | }, 17 | { 18 | "date": "2022-01-09", 19 | "temperatureC": -16, 20 | "summary": "Balmy" 21 | }, 22 | { 23 | "date": "2022-01-10", 24 | "temperatureC": -2, 25 | "summary": "Chilly" 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /BlazorAppWASM/BlazorAppWASM.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /BlazorAppWASM/Program.cs: -------------------------------------------------------------------------------- 1 | using BlazorAppWASM; 2 | using BlazorAppWASM.Authentications; 3 | using Microsoft.AspNetCore.Components.Authorization; 4 | using Microsoft.AspNetCore.Components.Web; 5 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 6 | 7 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 8 | builder.RootComponents.Add("#app"); 9 | builder.RootComponents.Add("head::after"); 10 | 11 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7095/") }); 12 | builder.Services.AddScoped(); 13 | builder.Services.AddAuthorizationCore(); 14 | await builder.Build().RunAsync(); 15 | -------------------------------------------------------------------------------- /BlazorAppWASM/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Not found 9 | 10 |

Sorry, there's nothing at this address.

11 |
12 |
13 |
14 |
15 | 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mastering .NET 8 Blazor Cookie🍪 Authentication Unlock Secrets with .NET Core Web API Endpoint! 🔐🚀 https://youtu.be/6HGS2z71Ix0
2 | ![Screenshot 2023-11-22 034731](https://github.com/Netcode-Hub/DotNet8CookieAuthenticationInBlazorWasmSolution/assets/110794348/32bd4e95-6609-44fb-bffd-267685b9424a) 3 | 4 | /*Follow Netcode-Hub*/
5 | https://netcodehub.blogspot.com
6 | https://github.com/Netcode-Hub
7 | https://twitter.com/NetcodeHub | Twitter
8 | https://web.facebook.com/NetcodeHub | Facebook
9 | https://www.linkedin.com/in/netcode-hub-90b188258/ | LinkedIn
10 | 11 | /*You can buy a coffee for me to support the channel*/ ☕️
12 | https://www.buymeacoffee.com/NetcodeHub
13 | 14 | PLEASE DO NOT FOGET TO STAR THIS REPOSITORY
15 | -------------------------------------------------------------------------------- /BlazorAppWASM/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | BlazorAppWASM 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 |
22 |
23 | 24 |
25 | An unhandled error has occurred. 26 | Reload 27 | 🗙 28 |
29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/DotNet8CookieAuthenticationInBlazorWasm.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | false 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | all 17 | runtime; build; native; contentfiles; analyzers; buildtransitive 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:45480", 8 | "sslPort": 44363 9 | } 10 | }, 11 | "profiles": { 12 | "http": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "launchUrl": "swagger", 17 | "applicationUrl": "http://localhost:5200", 18 | "environmentVariables": { 19 | "ASPNETCORE_ENVIRONMENT": "Development" 20 | } 21 | }, 22 | "https": { 23 | "commandName": "Project", 24 | "dotnetRunMessages": true, 25 | "launchBrowser": true, 26 | "launchUrl": "swagger", 27 | "applicationUrl": "https://localhost:7095;http://localhost:5200", 28 | "environmentVariables": { 29 | "ASPNETCORE_ENVIRONMENT": "Development" 30 | } 31 | }, 32 | "IIS Express": { 33 | "commandName": "IISExpress", 34 | "launchBrowser": true, 35 | "launchUrl": "swagger", 36 | "environmentVariables": { 37 | "ASPNETCORE_ENVIRONMENT": "Development" 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/Controllers/WeatherForecastController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Authorization; 2 | using Microsoft.AspNetCore.Mvc; 3 | 4 | namespace DotNet8CookieAuthenticationInBlazorWasm.Controllers 5 | { 6 | [ApiController] 7 | [Route("[controller]")] 8 | [Authorize] 9 | public class WeatherForecastController : ControllerBase 10 | { 11 | private static readonly string[] Summaries = new[] 12 | { 13 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 14 | }; 15 | 16 | private readonly ILogger _logger; 17 | 18 | public WeatherForecastController(ILogger logger) 19 | { 20 | _logger = logger; 21 | } 22 | 23 | [HttpGet(Name = "GetWeatherForecast")] 24 | public IEnumerable Get() 25 | { 26 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast 27 | { 28 | Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), 29 | TemperatureC = Random.Shared.Next(-20, 55), 30 | Summary = Summaries[Random.Shared.Next(Summaries.Length)] 31 | }) 32 | .ToArray(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /BlazorAppWASM/Pages/Home.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @using BlazorAppWASM.Authentications 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using BlazorAppWASM.Authentications 5 | @inject AuthenticationStateProvider authStateProvider 6 | Home 7 | 8 |

Hello, world!

9 | 10 | Welcome to your new app. 11 |
12 | 13 | 14 | Hello @context.User.Identity.Name 15 | I am checking up... 16 | You are not authorized 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @code { 27 | LoginModel LoginModel = new(); 28 | protected async override Task OnInitializedAsync() 29 | { 30 | 31 | } 32 | 33 | async Task Login() 34 | { 35 | var customAuthProvider = (CookieAuthenticationStateProvider)authStateProvider; 36 | await customAuthProvider.LoginAndGetAuthenticationState(LoginModel); 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /BlazorAppWASM/Layout/NavMenu.razor: -------------------------------------------------------------------------------- 1 | 9 | 10 | 29 | 30 | @code { 31 | private bool collapseNavMenu = true; 32 | 33 | private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; 34 | 35 | private void ToggleNavMenu() 36 | { 37 | collapseNavMenu = !collapseNavMenu; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /BlazorAppWASM/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:9251", 8 | "sslPort": 44388 9 | } 10 | }, 11 | "profiles": { 12 | "http": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 17 | "applicationUrl": "http://localhost:5289", 18 | "environmentVariables": { 19 | "ASPNETCORE_ENVIRONMENT": "Development" 20 | } 21 | }, 22 | "https": { 23 | "commandName": "Project", 24 | "dotnetRunMessages": true, 25 | "launchBrowser": true, 26 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 27 | "applicationUrl": "https://localhost:7194;http://localhost:5289", 28 | "environmentVariables": { 29 | "ASPNETCORE_ENVIRONMENT": "Development" 30 | } 31 | }, 32 | "IIS Express": { 33 | "commandName": "IISExpress", 34 | "launchBrowser": true, 35 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 36 | "environmentVariables": { 37 | "ASPNETCORE_ENVIRONMENT": "Development" 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /BlazorAppWASM/Layout/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row ::deep .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | text-decoration: none; 28 | } 29 | 30 | .top-row ::deep a:hover, .top-row ::deep .btn-link:hover { 31 | text-decoration: underline; 32 | } 33 | 34 | .top-row ::deep a:first-child { 35 | overflow: hidden; 36 | text-overflow: ellipsis; 37 | } 38 | 39 | @media (max-width: 640.98px) { 40 | .top-row { 41 | justify-content: space-between; 42 | } 43 | 44 | .top-row ::deep a, .top-row ::deep .btn-link { 45 | margin-left: 0; 46 | } 47 | } 48 | 49 | @media (min-width: 641px) { 50 | .page { 51 | flex-direction: row; 52 | } 53 | 54 | .sidebar { 55 | width: 250px; 56 | height: 100vh; 57 | position: sticky; 58 | top: 0; 59 | } 60 | 61 | .top-row { 62 | position: sticky; 63 | top: 0; 64 | z-index: 1; 65 | } 66 | 67 | .top-row.auth ::deep a:first-child { 68 | flex: 1; 69 | text-align: right; 70 | width: 0; 71 | } 72 | 73 | .top-row, article { 74 | padding-left: 2rem !important; 75 | padding-right: 1.5rem !important; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasmSolution.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.9.34310.174 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNet8CookieAuthenticationInBlazorWasm", "DotNet8CookieAuthenticationInBlazorWasm\DotNet8CookieAuthenticationInBlazorWasm.csproj", "{A610F344-0A75-45D9-AFCD-33BDE056BB5A}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorAppWASM", "BlazorAppWASM\BlazorAppWASM.csproj", "{3625E177-AE1B-44DA-B788-C56716DD9FCA}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {A610F344-0A75-45D9-AFCD-33BDE056BB5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {A610F344-0A75-45D9-AFCD-33BDE056BB5A}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {A610F344-0A75-45D9-AFCD-33BDE056BB5A}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {A610F344-0A75-45D9-AFCD-33BDE056BB5A}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {3625E177-AE1B-44DA-B788-C56716DD9FCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {3625E177-AE1B-44DA-B788-C56716DD9FCA}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {3625E177-AE1B-44DA-B788-C56716DD9FCA}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {3625E177-AE1B-44DA-B788-C56716DD9FCA}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {30B90275-34DC-4C8C-9E84-44987CC99393} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/Program.cs: -------------------------------------------------------------------------------- 1 | using DotNet8CookieAuthenticationInBlazorWasm; 2 | using Microsoft.AspNetCore.Identity; 3 | using Microsoft.EntityFrameworkCore; 4 | var MyAllowSpecificOrigins = "_myAllowSpecificOrigins"; 5 | var builder = WebApplication.CreateBuilder(args); 6 | 7 | // Add services to the container. 8 | 9 | builder.Services.AddControllers(); 10 | // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle 11 | builder.Services.AddEndpointsApiExplorer(); 12 | builder.Services.AddSwaggerGen(); 13 | 14 | builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))); 15 | builder.Services.AddAuthentication(IdentityConstants.ApplicationScheme) 16 | .AddIdentityCookies(); 17 | builder.Services.AddAuthorizationBuilder(); 18 | 19 | builder.Services.AddIdentityCore() 20 | .AddEntityFrameworkStores() 21 | .AddApiEndpoints(); 22 | 23 | builder.Services.AddCors(options => 24 | { 25 | options.AddPolicy(name: MyAllowSpecificOrigins, 26 | policy => 27 | { 28 | policy.WithOrigins("http://localhost:7194", 29 | "https://localhost:7194") 30 | .AllowAnyHeader() 31 | .AllowAnyMethod() 32 | .AllowCredentials(); 33 | 34 | }); 35 | }); 36 | var app = builder.Build(); 37 | 38 | // Configure the HTTP request pipeline. 39 | if (app.Environment.IsDevelopment()) 40 | { 41 | app.UseSwagger(); 42 | app.UseSwaggerUI(); 43 | } 44 | app.UseCors(MyAllowSpecificOrigins); 45 | app.MapIdentityApi(); 46 | app.UseHttpsRedirection(); 47 | 48 | app.UseAuthorization(); 49 | 50 | app.MapControllers(); 51 | 52 | app.Run(); 53 | -------------------------------------------------------------------------------- /BlazorAppWASM/Pages/Weather.razor: -------------------------------------------------------------------------------- 1 | @page "/weather" 2 | @inject HttpClient httpClient 3 | 4 | Weather 5 | 6 |

Weather

7 | 8 |

This component demonstrates fetching data from the server.

9 | 10 | @if (forecasts == null) 11 | { 12 |

Loading...

13 | } 14 | else 15 | { 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach (var forecast in forecasts) 27 | { 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | 36 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
37 | } 38 | 39 | @code { 40 | private WeatherForecast[]? forecasts; 41 | 42 | protected override async Task OnInitializedAsync() 43 | { 44 | var requestMessage = new HttpRequestMessage(HttpMethod.Get, "weatherforecast"); 45 | requestMessage.SetBrowserRequestCredentials(BrowserRequestCredentials.Include); 46 | var response = await httpClient.SendAsync(requestMessage); 47 | 48 | if (response.IsSuccessStatusCode) 49 | { 50 | // Deserialize the response content 51 | forecasts = await response.Content.ReadFromJsonAsync(); 52 | } 53 | } 54 | 55 | public class WeatherForecast 56 | { 57 | public DateOnly Date { get; set; } 58 | 59 | public int TemperatureC { get; set; } 60 | 61 | public string? Summary { get; set; } 62 | 63 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /BlazorAppWASM/Layout/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .bi { 15 | display: inline-block; 16 | position: relative; 17 | width: 1.25rem; 18 | height: 1.25rem; 19 | margin-right: 0.75rem; 20 | top: -1px; 21 | background-size: cover; 22 | } 23 | 24 | .bi-house-door-fill-nav-menu { 25 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E"); 26 | } 27 | 28 | .bi-plus-square-fill-nav-menu { 29 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E"); 30 | } 31 | 32 | .bi-list-nested-nav-menu { 33 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E"); 34 | } 35 | 36 | .nav-item { 37 | font-size: 0.9rem; 38 | padding-bottom: 0.5rem; 39 | } 40 | 41 | .nav-item:first-of-type { 42 | padding-top: 1rem; 43 | } 44 | 45 | .nav-item:last-of-type { 46 | padding-bottom: 1rem; 47 | } 48 | 49 | .nav-item ::deep a { 50 | color: #d7d7d7; 51 | border-radius: 4px; 52 | height: 3rem; 53 | display: flex; 54 | align-items: center; 55 | line-height: 3rem; 56 | } 57 | 58 | .nav-item ::deep a.active { 59 | background-color: rgba(255,255,255,0.37); 60 | color: white; 61 | } 62 | 63 | .nav-item ::deep a:hover { 64 | background-color: rgba(255,255,255,0.1); 65 | color: white; 66 | } 67 | 68 | @media (min-width: 641px) { 69 | .navbar-toggler { 70 | display: none; 71 | } 72 | 73 | .collapse { 74 | /* Never collapse the sidebar for wide screens */ 75 | display: block; 76 | } 77 | 78 | .nav-scrollable { 79 | /* Allow sidebar to scroll for tall menus */ 80 | height: calc(100vh - 3.5rem); 81 | overflow-y: auto; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /BlazorAppWASM/Authentications/CookieAuthenticationStateProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components.Authorization; 2 | using Microsoft.AspNetCore.Components.WebAssembly.Http; 3 | using System.Security.Claims; 4 | using System.Text; 5 | using System.Text.Json; 6 | 7 | namespace BlazorAppWASM.Authentications 8 | { 9 | public class CookieAuthenticationStateProvider : AuthenticationStateProvider 10 | { 11 | private readonly HttpClient httpClient; 12 | 13 | public CookieAuthenticationStateProvider(HttpClient httpClient) 14 | { 15 | this.httpClient = httpClient; 16 | } 17 | public async override Task GetAuthenticationStateAsync() 18 | { 19 | var user = new ClaimsPrincipal(new ClaimsIdentity()); 20 | 21 | try 22 | { 23 | var requestMessage = new HttpRequestMessage(HttpMethod.Get, "manage/info"); 24 | requestMessage.SetBrowserRequestCredentials(BrowserRequestCredentials.Include); 25 | var userResponse = await httpClient.SendAsync(requestMessage); 26 | if (userResponse.IsSuccessStatusCode) 27 | { 28 | var userJson = await userResponse.Content.ReadAsStringAsync(); 29 | var jsonSOptions = new JsonSerializerOptions { AllowTrailingCommas = true, PropertyNameCaseInsensitive = true }; 30 | var userInfo = JsonSerializer.Deserialize(userJson, jsonSOptions); 31 | if (userInfo != null) 32 | { 33 | var claims = new List 34 | { 35 | new(ClaimTypes.Name, userInfo.Email!), 36 | new(ClaimTypes.Email, userInfo.Email!) 37 | }; 38 | var id = new ClaimsIdentity(claims, nameof(CookieAuthenticationStateProvider)); 39 | user = new ClaimsPrincipal(id); 40 | } 41 | } 42 | return new AuthenticationState(user); 43 | } 44 | catch { return new AuthenticationState(user); } 45 | } 46 | 47 | public async Task LoginAndGetAuthenticationState(LoginModel model) 48 | { 49 | //model.Email = "fred@gmail.com"; model.Password = "Fred@123"; 50 | var jsonContent = new StringContent(JsonSerializer.Serialize(model), Encoding.UTF8, "application/json"); 51 | var requestMessage = new HttpRequestMessage(HttpMethod.Post, "login?useCookies=true") 52 | { 53 | Content = jsonContent 54 | }; 55 | requestMessage.SetBrowserRequestCredentials(BrowserRequestCredentials.Include); 56 | var userResponse = await httpClient.SendAsync(requestMessage); 57 | if (userResponse.IsSuccessStatusCode) 58 | NotifyAuthenticationStateChanged(GetAuthenticationStateAsync()); 59 | else 60 | return; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /BlazorAppWASM/wwwroot/css/app.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 3 | } 4 | 5 | h1:focus { 6 | outline: none; 7 | } 8 | 9 | a, .btn-link { 10 | color: #0071c1; 11 | } 12 | 13 | .btn-primary { 14 | color: #fff; 15 | background-color: #1b6ec2; 16 | border-color: #1861ac; 17 | } 18 | 19 | .btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus { 20 | box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb; 21 | } 22 | 23 | .content { 24 | padding-top: 1.1rem; 25 | } 26 | 27 | .valid.modified:not([type=checkbox]) { 28 | outline: 1px solid #26b050; 29 | } 30 | 31 | .invalid { 32 | outline: 1px solid red; 33 | } 34 | 35 | .validation-message { 36 | color: red; 37 | } 38 | 39 | #blazor-error-ui { 40 | background: lightyellow; 41 | bottom: 0; 42 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 43 | display: none; 44 | left: 0; 45 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 46 | position: fixed; 47 | width: 100%; 48 | z-index: 1000; 49 | } 50 | 51 | #blazor-error-ui .dismiss { 52 | cursor: pointer; 53 | position: absolute; 54 | right: 0.75rem; 55 | top: 0.5rem; 56 | } 57 | 58 | .blazor-error-boundary { 59 | background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121; 60 | padding: 1rem 1rem 1rem 3.7rem; 61 | color: white; 62 | } 63 | 64 | .blazor-error-boundary::after { 65 | content: "An error has occurred." 66 | } 67 | 68 | .loading-progress { 69 | position: relative; 70 | display: block; 71 | width: 8rem; 72 | height: 8rem; 73 | margin: 20vh auto 1rem auto; 74 | } 75 | 76 | .loading-progress circle { 77 | fill: none; 78 | stroke: #e0e0e0; 79 | stroke-width: 0.6rem; 80 | transform-origin: 50% 50%; 81 | transform: rotate(-90deg); 82 | } 83 | 84 | .loading-progress circle:last-child { 85 | stroke: #1b6ec2; 86 | stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; 87 | transition: stroke-dasharray 0.05s ease-in-out; 88 | } 89 | 90 | .loading-progress-text { 91 | position: absolute; 92 | text-align: center; 93 | font-weight: bold; 94 | inset: calc(20vh + 3.25rem) 0 auto 0.2rem; 95 | } 96 | 97 | .loading-progress-text:after { 98 | content: var(--blazor-load-percentage-text, "Loading"); 99 | } 100 | 101 | code { 102 | color: #c02d76; 103 | } 104 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/Migrations/20231121152331_First.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | #nullable disable 5 | 6 | namespace DotNet8CookieAuthenticationInBlazorWasm.Migrations 7 | { 8 | /// 9 | public partial class First : Migration 10 | { 11 | /// 12 | protected override void Up(MigrationBuilder migrationBuilder) 13 | { 14 | migrationBuilder.CreateTable( 15 | name: "AspNetRoles", 16 | columns: table => new 17 | { 18 | Id = table.Column(type: "nvarchar(450)", nullable: false), 19 | Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 20 | NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 21 | ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true) 22 | }, 23 | constraints: table => 24 | { 25 | table.PrimaryKey("PK_AspNetRoles", x => x.Id); 26 | }); 27 | 28 | migrationBuilder.CreateTable( 29 | name: "AspNetUsers", 30 | columns: table => new 31 | { 32 | Id = table.Column(type: "nvarchar(450)", nullable: false), 33 | UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 34 | NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 35 | Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 36 | NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 37 | EmailConfirmed = table.Column(type: "bit", nullable: false), 38 | PasswordHash = table.Column(type: "nvarchar(max)", nullable: true), 39 | SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true), 40 | ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), 41 | PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true), 42 | PhoneNumberConfirmed = table.Column(type: "bit", nullable: false), 43 | TwoFactorEnabled = table.Column(type: "bit", nullable: false), 44 | LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), 45 | LockoutEnabled = table.Column(type: "bit", nullable: false), 46 | AccessFailedCount = table.Column(type: "int", nullable: false) 47 | }, 48 | constraints: table => 49 | { 50 | table.PrimaryKey("PK_AspNetUsers", x => x.Id); 51 | }); 52 | 53 | migrationBuilder.CreateTable( 54 | name: "AspNetRoleClaims", 55 | columns: table => new 56 | { 57 | Id = table.Column(type: "int", nullable: false) 58 | .Annotation("SqlServer:Identity", "1, 1"), 59 | RoleId = table.Column(type: "nvarchar(450)", nullable: false), 60 | ClaimType = table.Column(type: "nvarchar(max)", nullable: true), 61 | ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) 62 | }, 63 | constraints: table => 64 | { 65 | table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); 66 | table.ForeignKey( 67 | name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", 68 | column: x => x.RoleId, 69 | principalTable: "AspNetRoles", 70 | principalColumn: "Id", 71 | onDelete: ReferentialAction.Cascade); 72 | }); 73 | 74 | migrationBuilder.CreateTable( 75 | name: "AspNetUserClaims", 76 | columns: table => new 77 | { 78 | Id = table.Column(type: "int", nullable: false) 79 | .Annotation("SqlServer:Identity", "1, 1"), 80 | UserId = table.Column(type: "nvarchar(450)", nullable: false), 81 | ClaimType = table.Column(type: "nvarchar(max)", nullable: true), 82 | ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) 83 | }, 84 | constraints: table => 85 | { 86 | table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); 87 | table.ForeignKey( 88 | name: "FK_AspNetUserClaims_AspNetUsers_UserId", 89 | column: x => x.UserId, 90 | principalTable: "AspNetUsers", 91 | principalColumn: "Id", 92 | onDelete: ReferentialAction.Cascade); 93 | }); 94 | 95 | migrationBuilder.CreateTable( 96 | name: "AspNetUserLogins", 97 | columns: table => new 98 | { 99 | LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), 100 | ProviderKey = table.Column(type: "nvarchar(450)", nullable: false), 101 | ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true), 102 | UserId = table.Column(type: "nvarchar(450)", nullable: false) 103 | }, 104 | constraints: table => 105 | { 106 | table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); 107 | table.ForeignKey( 108 | name: "FK_AspNetUserLogins_AspNetUsers_UserId", 109 | column: x => x.UserId, 110 | principalTable: "AspNetUsers", 111 | principalColumn: "Id", 112 | onDelete: ReferentialAction.Cascade); 113 | }); 114 | 115 | migrationBuilder.CreateTable( 116 | name: "AspNetUserRoles", 117 | columns: table => new 118 | { 119 | UserId = table.Column(type: "nvarchar(450)", nullable: false), 120 | RoleId = table.Column(type: "nvarchar(450)", nullable: false) 121 | }, 122 | constraints: table => 123 | { 124 | table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); 125 | table.ForeignKey( 126 | name: "FK_AspNetUserRoles_AspNetRoles_RoleId", 127 | column: x => x.RoleId, 128 | principalTable: "AspNetRoles", 129 | principalColumn: "Id", 130 | onDelete: ReferentialAction.Cascade); 131 | table.ForeignKey( 132 | name: "FK_AspNetUserRoles_AspNetUsers_UserId", 133 | column: x => x.UserId, 134 | principalTable: "AspNetUsers", 135 | principalColumn: "Id", 136 | onDelete: ReferentialAction.Cascade); 137 | }); 138 | 139 | migrationBuilder.CreateTable( 140 | name: "AspNetUserTokens", 141 | columns: table => new 142 | { 143 | UserId = table.Column(type: "nvarchar(450)", nullable: false), 144 | LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), 145 | Name = table.Column(type: "nvarchar(450)", nullable: false), 146 | Value = table.Column(type: "nvarchar(max)", nullable: true) 147 | }, 148 | constraints: table => 149 | { 150 | table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); 151 | table.ForeignKey( 152 | name: "FK_AspNetUserTokens_AspNetUsers_UserId", 153 | column: x => x.UserId, 154 | principalTable: "AspNetUsers", 155 | principalColumn: "Id", 156 | onDelete: ReferentialAction.Cascade); 157 | }); 158 | 159 | migrationBuilder.CreateIndex( 160 | name: "IX_AspNetRoleClaims_RoleId", 161 | table: "AspNetRoleClaims", 162 | column: "RoleId"); 163 | 164 | migrationBuilder.CreateIndex( 165 | name: "RoleNameIndex", 166 | table: "AspNetRoles", 167 | column: "NormalizedName", 168 | unique: true, 169 | filter: "[NormalizedName] IS NOT NULL"); 170 | 171 | migrationBuilder.CreateIndex( 172 | name: "IX_AspNetUserClaims_UserId", 173 | table: "AspNetUserClaims", 174 | column: "UserId"); 175 | 176 | migrationBuilder.CreateIndex( 177 | name: "IX_AspNetUserLogins_UserId", 178 | table: "AspNetUserLogins", 179 | column: "UserId"); 180 | 181 | migrationBuilder.CreateIndex( 182 | name: "IX_AspNetUserRoles_RoleId", 183 | table: "AspNetUserRoles", 184 | column: "RoleId"); 185 | 186 | migrationBuilder.CreateIndex( 187 | name: "EmailIndex", 188 | table: "AspNetUsers", 189 | column: "NormalizedEmail"); 190 | 191 | migrationBuilder.CreateIndex( 192 | name: "UserNameIndex", 193 | table: "AspNetUsers", 194 | column: "NormalizedUserName", 195 | unique: true, 196 | filter: "[NormalizedUserName] IS NOT NULL"); 197 | } 198 | 199 | /// 200 | protected override void Down(MigrationBuilder migrationBuilder) 201 | { 202 | migrationBuilder.DropTable( 203 | name: "AspNetRoleClaims"); 204 | 205 | migrationBuilder.DropTable( 206 | name: "AspNetUserClaims"); 207 | 208 | migrationBuilder.DropTable( 209 | name: "AspNetUserLogins"); 210 | 211 | migrationBuilder.DropTable( 212 | name: "AspNetUserRoles"); 213 | 214 | migrationBuilder.DropTable( 215 | name: "AspNetUserTokens"); 216 | 217 | migrationBuilder.DropTable( 218 | name: "AspNetRoles"); 219 | 220 | migrationBuilder.DropTable( 221 | name: "AspNetUsers"); 222 | } 223 | } 224 | } 225 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/Migrations/AppDbContextModelSnapshot.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using DotNet8CookieAuthenticationInBlazorWasm; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | 9 | #nullable disable 10 | 11 | namespace DotNet8CookieAuthenticationInBlazorWasm.Migrations 12 | { 13 | [DbContext(typeof(AppDbContext))] 14 | partial class AppDbContextModelSnapshot : ModelSnapshot 15 | { 16 | protected override void BuildModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .HasAnnotation("ProductVersion", "8.0.0-rc.2.23480.1") 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 22 | 23 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 24 | 25 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => 26 | { 27 | b.Property("Id") 28 | .HasColumnType("nvarchar(450)"); 29 | 30 | b.Property("ConcurrencyStamp") 31 | .IsConcurrencyToken() 32 | .HasColumnType("nvarchar(max)"); 33 | 34 | b.Property("Name") 35 | .HasMaxLength(256) 36 | .HasColumnType("nvarchar(256)"); 37 | 38 | b.Property("NormalizedName") 39 | .HasMaxLength(256) 40 | .HasColumnType("nvarchar(256)"); 41 | 42 | b.HasKey("Id"); 43 | 44 | b.HasIndex("NormalizedName") 45 | .IsUnique() 46 | .HasDatabaseName("RoleNameIndex") 47 | .HasFilter("[NormalizedName] IS NOT NULL"); 48 | 49 | b.ToTable("AspNetRoles", (string)null); 50 | }); 51 | 52 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 53 | { 54 | b.Property("Id") 55 | .ValueGeneratedOnAdd() 56 | .HasColumnType("int"); 57 | 58 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 59 | 60 | b.Property("ClaimType") 61 | .HasColumnType("nvarchar(max)"); 62 | 63 | b.Property("ClaimValue") 64 | .HasColumnType("nvarchar(max)"); 65 | 66 | b.Property("RoleId") 67 | .IsRequired() 68 | .HasColumnType("nvarchar(450)"); 69 | 70 | b.HasKey("Id"); 71 | 72 | b.HasIndex("RoleId"); 73 | 74 | b.ToTable("AspNetRoleClaims", (string)null); 75 | }); 76 | 77 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => 78 | { 79 | b.Property("Id") 80 | .HasColumnType("nvarchar(450)"); 81 | 82 | b.Property("AccessFailedCount") 83 | .HasColumnType("int"); 84 | 85 | b.Property("ConcurrencyStamp") 86 | .IsConcurrencyToken() 87 | .HasColumnType("nvarchar(max)"); 88 | 89 | b.Property("Email") 90 | .HasMaxLength(256) 91 | .HasColumnType("nvarchar(256)"); 92 | 93 | b.Property("EmailConfirmed") 94 | .HasColumnType("bit"); 95 | 96 | b.Property("LockoutEnabled") 97 | .HasColumnType("bit"); 98 | 99 | b.Property("LockoutEnd") 100 | .HasColumnType("datetimeoffset"); 101 | 102 | b.Property("NormalizedEmail") 103 | .HasMaxLength(256) 104 | .HasColumnType("nvarchar(256)"); 105 | 106 | b.Property("NormalizedUserName") 107 | .HasMaxLength(256) 108 | .HasColumnType("nvarchar(256)"); 109 | 110 | b.Property("PasswordHash") 111 | .HasColumnType("nvarchar(max)"); 112 | 113 | b.Property("PhoneNumber") 114 | .HasColumnType("nvarchar(max)"); 115 | 116 | b.Property("PhoneNumberConfirmed") 117 | .HasColumnType("bit"); 118 | 119 | b.Property("SecurityStamp") 120 | .HasColumnType("nvarchar(max)"); 121 | 122 | b.Property("TwoFactorEnabled") 123 | .HasColumnType("bit"); 124 | 125 | b.Property("UserName") 126 | .HasMaxLength(256) 127 | .HasColumnType("nvarchar(256)"); 128 | 129 | b.HasKey("Id"); 130 | 131 | b.HasIndex("NormalizedEmail") 132 | .HasDatabaseName("EmailIndex"); 133 | 134 | b.HasIndex("NormalizedUserName") 135 | .IsUnique() 136 | .HasDatabaseName("UserNameIndex") 137 | .HasFilter("[NormalizedUserName] IS NOT NULL"); 138 | 139 | b.ToTable("AspNetUsers", (string)null); 140 | }); 141 | 142 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 143 | { 144 | b.Property("Id") 145 | .ValueGeneratedOnAdd() 146 | .HasColumnType("int"); 147 | 148 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 149 | 150 | b.Property("ClaimType") 151 | .HasColumnType("nvarchar(max)"); 152 | 153 | b.Property("ClaimValue") 154 | .HasColumnType("nvarchar(max)"); 155 | 156 | b.Property("UserId") 157 | .IsRequired() 158 | .HasColumnType("nvarchar(450)"); 159 | 160 | b.HasKey("Id"); 161 | 162 | b.HasIndex("UserId"); 163 | 164 | b.ToTable("AspNetUserClaims", (string)null); 165 | }); 166 | 167 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 168 | { 169 | b.Property("LoginProvider") 170 | .HasColumnType("nvarchar(450)"); 171 | 172 | b.Property("ProviderKey") 173 | .HasColumnType("nvarchar(450)"); 174 | 175 | b.Property("ProviderDisplayName") 176 | .HasColumnType("nvarchar(max)"); 177 | 178 | b.Property("UserId") 179 | .IsRequired() 180 | .HasColumnType("nvarchar(450)"); 181 | 182 | b.HasKey("LoginProvider", "ProviderKey"); 183 | 184 | b.HasIndex("UserId"); 185 | 186 | b.ToTable("AspNetUserLogins", (string)null); 187 | }); 188 | 189 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 190 | { 191 | b.Property("UserId") 192 | .HasColumnType("nvarchar(450)"); 193 | 194 | b.Property("RoleId") 195 | .HasColumnType("nvarchar(450)"); 196 | 197 | b.HasKey("UserId", "RoleId"); 198 | 199 | b.HasIndex("RoleId"); 200 | 201 | b.ToTable("AspNetUserRoles", (string)null); 202 | }); 203 | 204 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 205 | { 206 | b.Property("UserId") 207 | .HasColumnType("nvarchar(450)"); 208 | 209 | b.Property("LoginProvider") 210 | .HasColumnType("nvarchar(450)"); 211 | 212 | b.Property("Name") 213 | .HasColumnType("nvarchar(450)"); 214 | 215 | b.Property("Value") 216 | .HasColumnType("nvarchar(max)"); 217 | 218 | b.HasKey("UserId", "LoginProvider", "Name"); 219 | 220 | b.ToTable("AspNetUserTokens", (string)null); 221 | }); 222 | 223 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 224 | { 225 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) 226 | .WithMany() 227 | .HasForeignKey("RoleId") 228 | .OnDelete(DeleteBehavior.Cascade) 229 | .IsRequired(); 230 | }); 231 | 232 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 233 | { 234 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) 235 | .WithMany() 236 | .HasForeignKey("UserId") 237 | .OnDelete(DeleteBehavior.Cascade) 238 | .IsRequired(); 239 | }); 240 | 241 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 242 | { 243 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) 244 | .WithMany() 245 | .HasForeignKey("UserId") 246 | .OnDelete(DeleteBehavior.Cascade) 247 | .IsRequired(); 248 | }); 249 | 250 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 251 | { 252 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) 253 | .WithMany() 254 | .HasForeignKey("RoleId") 255 | .OnDelete(DeleteBehavior.Cascade) 256 | .IsRequired(); 257 | 258 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) 259 | .WithMany() 260 | .HasForeignKey("UserId") 261 | .OnDelete(DeleteBehavior.Cascade) 262 | .IsRequired(); 263 | }); 264 | 265 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 266 | { 267 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) 268 | .WithMany() 269 | .HasForeignKey("UserId") 270 | .OnDelete(DeleteBehavior.Cascade) 271 | .IsRequired(); 272 | }); 273 | #pragma warning restore 612, 618 274 | } 275 | } 276 | } 277 | -------------------------------------------------------------------------------- /DotNet8CookieAuthenticationInBlazorWasm/Migrations/20231121152331_First.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using DotNet8CookieAuthenticationInBlazorWasm; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | #nullable disable 11 | 12 | namespace DotNet8CookieAuthenticationInBlazorWasm.Migrations 13 | { 14 | [DbContext(typeof(AppDbContext))] 15 | [Migration("20231121152331_First")] 16 | partial class First 17 | { 18 | /// 19 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 20 | { 21 | #pragma warning disable 612, 618 22 | modelBuilder 23 | .HasAnnotation("ProductVersion", "8.0.0-rc.2.23480.1") 24 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 25 | 26 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 27 | 28 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => 29 | { 30 | b.Property("Id") 31 | .HasColumnType("nvarchar(450)"); 32 | 33 | b.Property("ConcurrencyStamp") 34 | .IsConcurrencyToken() 35 | .HasColumnType("nvarchar(max)"); 36 | 37 | b.Property("Name") 38 | .HasMaxLength(256) 39 | .HasColumnType("nvarchar(256)"); 40 | 41 | b.Property("NormalizedName") 42 | .HasMaxLength(256) 43 | .HasColumnType("nvarchar(256)"); 44 | 45 | b.HasKey("Id"); 46 | 47 | b.HasIndex("NormalizedName") 48 | .IsUnique() 49 | .HasDatabaseName("RoleNameIndex") 50 | .HasFilter("[NormalizedName] IS NOT NULL"); 51 | 52 | b.ToTable("AspNetRoles", (string)null); 53 | }); 54 | 55 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 56 | { 57 | b.Property("Id") 58 | .ValueGeneratedOnAdd() 59 | .HasColumnType("int"); 60 | 61 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 62 | 63 | b.Property("ClaimType") 64 | .HasColumnType("nvarchar(max)"); 65 | 66 | b.Property("ClaimValue") 67 | .HasColumnType("nvarchar(max)"); 68 | 69 | b.Property("RoleId") 70 | .IsRequired() 71 | .HasColumnType("nvarchar(450)"); 72 | 73 | b.HasKey("Id"); 74 | 75 | b.HasIndex("RoleId"); 76 | 77 | b.ToTable("AspNetRoleClaims", (string)null); 78 | }); 79 | 80 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => 81 | { 82 | b.Property("Id") 83 | .HasColumnType("nvarchar(450)"); 84 | 85 | b.Property("AccessFailedCount") 86 | .HasColumnType("int"); 87 | 88 | b.Property("ConcurrencyStamp") 89 | .IsConcurrencyToken() 90 | .HasColumnType("nvarchar(max)"); 91 | 92 | b.Property("Email") 93 | .HasMaxLength(256) 94 | .HasColumnType("nvarchar(256)"); 95 | 96 | b.Property("EmailConfirmed") 97 | .HasColumnType("bit"); 98 | 99 | b.Property("LockoutEnabled") 100 | .HasColumnType("bit"); 101 | 102 | b.Property("LockoutEnd") 103 | .HasColumnType("datetimeoffset"); 104 | 105 | b.Property("NormalizedEmail") 106 | .HasMaxLength(256) 107 | .HasColumnType("nvarchar(256)"); 108 | 109 | b.Property("NormalizedUserName") 110 | .HasMaxLength(256) 111 | .HasColumnType("nvarchar(256)"); 112 | 113 | b.Property("PasswordHash") 114 | .HasColumnType("nvarchar(max)"); 115 | 116 | b.Property("PhoneNumber") 117 | .HasColumnType("nvarchar(max)"); 118 | 119 | b.Property("PhoneNumberConfirmed") 120 | .HasColumnType("bit"); 121 | 122 | b.Property("SecurityStamp") 123 | .HasColumnType("nvarchar(max)"); 124 | 125 | b.Property("TwoFactorEnabled") 126 | .HasColumnType("bit"); 127 | 128 | b.Property("UserName") 129 | .HasMaxLength(256) 130 | .HasColumnType("nvarchar(256)"); 131 | 132 | b.HasKey("Id"); 133 | 134 | b.HasIndex("NormalizedEmail") 135 | .HasDatabaseName("EmailIndex"); 136 | 137 | b.HasIndex("NormalizedUserName") 138 | .IsUnique() 139 | .HasDatabaseName("UserNameIndex") 140 | .HasFilter("[NormalizedUserName] IS NOT NULL"); 141 | 142 | b.ToTable("AspNetUsers", (string)null); 143 | }); 144 | 145 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 146 | { 147 | b.Property("Id") 148 | .ValueGeneratedOnAdd() 149 | .HasColumnType("int"); 150 | 151 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 152 | 153 | b.Property("ClaimType") 154 | .HasColumnType("nvarchar(max)"); 155 | 156 | b.Property("ClaimValue") 157 | .HasColumnType("nvarchar(max)"); 158 | 159 | b.Property("UserId") 160 | .IsRequired() 161 | .HasColumnType("nvarchar(450)"); 162 | 163 | b.HasKey("Id"); 164 | 165 | b.HasIndex("UserId"); 166 | 167 | b.ToTable("AspNetUserClaims", (string)null); 168 | }); 169 | 170 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 171 | { 172 | b.Property("LoginProvider") 173 | .HasColumnType("nvarchar(450)"); 174 | 175 | b.Property("ProviderKey") 176 | .HasColumnType("nvarchar(450)"); 177 | 178 | b.Property("ProviderDisplayName") 179 | .HasColumnType("nvarchar(max)"); 180 | 181 | b.Property("UserId") 182 | .IsRequired() 183 | .HasColumnType("nvarchar(450)"); 184 | 185 | b.HasKey("LoginProvider", "ProviderKey"); 186 | 187 | b.HasIndex("UserId"); 188 | 189 | b.ToTable("AspNetUserLogins", (string)null); 190 | }); 191 | 192 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 193 | { 194 | b.Property("UserId") 195 | .HasColumnType("nvarchar(450)"); 196 | 197 | b.Property("RoleId") 198 | .HasColumnType("nvarchar(450)"); 199 | 200 | b.HasKey("UserId", "RoleId"); 201 | 202 | b.HasIndex("RoleId"); 203 | 204 | b.ToTable("AspNetUserRoles", (string)null); 205 | }); 206 | 207 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 208 | { 209 | b.Property("UserId") 210 | .HasColumnType("nvarchar(450)"); 211 | 212 | b.Property("LoginProvider") 213 | .HasColumnType("nvarchar(450)"); 214 | 215 | b.Property("Name") 216 | .HasColumnType("nvarchar(450)"); 217 | 218 | b.Property("Value") 219 | .HasColumnType("nvarchar(max)"); 220 | 221 | b.HasKey("UserId", "LoginProvider", "Name"); 222 | 223 | b.ToTable("AspNetUserTokens", (string)null); 224 | }); 225 | 226 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 227 | { 228 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) 229 | .WithMany() 230 | .HasForeignKey("RoleId") 231 | .OnDelete(DeleteBehavior.Cascade) 232 | .IsRequired(); 233 | }); 234 | 235 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 236 | { 237 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) 238 | .WithMany() 239 | .HasForeignKey("UserId") 240 | .OnDelete(DeleteBehavior.Cascade) 241 | .IsRequired(); 242 | }); 243 | 244 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 245 | { 246 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) 247 | .WithMany() 248 | .HasForeignKey("UserId") 249 | .OnDelete(DeleteBehavior.Cascade) 250 | .IsRequired(); 251 | }); 252 | 253 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 254 | { 255 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) 256 | .WithMany() 257 | .HasForeignKey("RoleId") 258 | .OnDelete(DeleteBehavior.Cascade) 259 | .IsRequired(); 260 | 261 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) 262 | .WithMany() 263 | .HasForeignKey("UserId") 264 | .OnDelete(DeleteBehavior.Cascade) 265 | .IsRequired(); 266 | }); 267 | 268 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 269 | { 270 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) 271 | .WithMany() 272 | .HasForeignKey("UserId") 273 | .OnDelete(DeleteBehavior.Cascade) 274 | .IsRequired(); 275 | }); 276 | #pragma warning restore 612, 618 277 | } 278 | } 279 | } 280 | --------------------------------------------------------------------------------