|
| 1 | +using CodeBeam.UltimateAuth.Authorization.InMemory; |
| 2 | +using CodeBeam.UltimateAuth.Authorization.InMemory.Extensions; |
| 3 | +using CodeBeam.UltimateAuth.Authorization.Reference.Extensions; |
1 | 4 | using CodeBeam.UltimateAuth.Client.Extensions; |
2 | 5 | using CodeBeam.UltimateAuth.Core.Domain; |
3 | 6 | using CodeBeam.UltimateAuth.Core.Extensions; |
4 | | -using CodeBeam.UltimateAuth.Credentials.InMemory; |
| 7 | +using CodeBeam.UltimateAuth.Credentials.InMemory.Extensions; |
| 8 | +using CodeBeam.UltimateAuth.Credentials.Reference; |
5 | 9 | using CodeBeam.UltimateAuth.Sample.BlazorServer.Components; |
6 | 10 | using CodeBeam.UltimateAuth.Security.Argon2; |
7 | 11 | using CodeBeam.UltimateAuth.Server.Authentication; |
| 12 | +using CodeBeam.UltimateAuth.Server.Defaults; |
8 | 13 | using CodeBeam.UltimateAuth.Server.Extensions; |
9 | 14 | using CodeBeam.UltimateAuth.Sessions.InMemory; |
10 | 15 | using CodeBeam.UltimateAuth.Tokens.InMemory; |
| 16 | +using CodeBeam.UltimateAuth.Users.InMemory.Extensions; |
| 17 | +using CodeBeam.UltimateAuth.Users.Reference; |
| 18 | +using CodeBeam.UltimateAuth.Users.Reference.Extensions; |
11 | 19 | using Microsoft.AspNetCore.Components; |
12 | 20 | using MudBlazor.Services; |
13 | 21 | using MudExtensions.Services; |
| 22 | +using Scalar.AspNetCore; |
14 | 23 |
|
15 | 24 | var builder = WebApplication.CreateBuilder(args); |
16 | 25 |
|
|
24 | 33 |
|
25 | 34 | builder.Services.AddMudServices(); |
26 | 35 | builder.Services.AddMudExtensions(); |
| 36 | +builder.Services.AddEndpointsApiExplorer(); |
| 37 | +builder.Services.AddOpenApi(); |
27 | 38 |
|
28 | 39 | builder.Services |
29 | 40 | .AddAuthentication(options => |
|
44 | 55 | //o.Session.TouchInterval = TimeSpan.FromSeconds(9); |
45 | 56 | //o.Session.IdleTimeout = TimeSpan.FromSeconds(15); |
46 | 57 | }) |
47 | | - .AddInMemoryCredentials() |
| 58 | + .AddUltimateAuthUsersInMemory() |
| 59 | + .AddUltimateAuthUsersReference() |
| 60 | + .AddUltimateAuthCredentialsInMemory() |
| 61 | + .AddUltimateAuthCredentialsReference() |
| 62 | + .AddUltimateAuthAuthorizationInMemory() |
| 63 | + .AddUltimateAuthAuthorizationReference() |
48 | 64 | .AddUltimateAuthInMemorySessions() |
49 | 65 | .AddUltimateAuthInMemoryTokens() |
50 | 66 | .AddUltimateAuthArgon2(); |
|
80 | 96 |
|
81 | 97 | var app = builder.Build(); |
82 | 98 |
|
| 99 | +using (var scope = app.Services.CreateScope()) |
| 100 | +{ |
| 101 | + scope.ServiceProvider.GetRequiredService<IUserLifecycleStore>(); |
| 102 | + //scope.ServiceProvider.GetRequiredService<IUserProfileStore>(); |
| 103 | + //scope.ServiceProvider.GetRequiredService<IUserStore<UserKey>>(); |
| 104 | + |
| 105 | + var seeder = scope.ServiceProvider.GetService<IAuthorizationSeeder>(); |
| 106 | + //if (seeder is not null) |
| 107 | + // await seeder.SeedAsync(); |
| 108 | +} |
| 109 | + |
83 | 110 | // Configure the HTTP request pipeline. |
84 | 111 | if (!app.Environment.IsDevelopment()) |
85 | 112 | { |
86 | 113 | app.UseExceptionHandler("/Error", createScopeForErrors: true); |
87 | 114 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. |
88 | 115 | app.UseHsts(); |
89 | 116 | } |
| 117 | +else |
| 118 | +{ |
| 119 | + app.MapOpenApi(); |
| 120 | + app.MapScalarApiReference(); |
| 121 | +} |
90 | 122 |
|
91 | 123 | app.UseHttpsRedirection(); |
92 | 124 |
|
|
0 commit comments