|
1 | | -using IdentityManager2.AspNetIdentity; |
2 | | -using Microsoft.AspNetCore.Builder; |
3 | | -using Microsoft.AspNetCore.Identity; |
4 | | -using Microsoft.AspNetCore.Identity.EntityFrameworkCore; |
5 | | -using Microsoft.EntityFrameworkCore; |
6 | | -using Microsoft.Extensions.DependencyInjection; |
7 | | - |
8 | | -namespace Host |
9 | | -{ |
10 | | - public class Startup |
11 | | - { |
12 | | - public void ConfigureServices(IServiceCollection services) |
13 | | - { |
14 | | - services.AddDbContext<IdentityDbContext>(opt => opt.UseInMemoryDatabase("test")); |
15 | | - |
16 | | - services.AddIdentity<IdentityUser, IdentityRole>() |
17 | | - .AddEntityFrameworkStores<IdentityDbContext>() |
18 | | - .AddDefaultTokenProviders(); |
19 | | - |
20 | | - services.AddIdentityManager() |
21 | | - .AddIdentityMangerService<AspNetCoreIdentityManagerService<IdentityUser, string, IdentityRole, string>>(); |
22 | | - } |
23 | | - |
24 | | - public void Configure(IApplicationBuilder app) |
25 | | - { |
26 | | - app.UseDeveloperExceptionPage(); |
27 | | - |
28 | | - app.UseRouting(); |
29 | | - |
30 | | - app.UseAuthentication(); |
31 | | - app.UseAuthorization(); |
32 | | - |
33 | | - app.UseIdentityManager(); |
34 | | - |
35 | | - app.UseEndpoints(x => x.MapDefaultControllerRoute()); |
36 | | - } |
37 | | - } |
38 | | -} |
| 1 | +using IdentityManager2.AspNetIdentity; |
| 2 | +using Microsoft.AspNetCore.Builder; |
| 3 | +using Microsoft.AspNetCore.Identity; |
| 4 | +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; |
| 5 | +using Microsoft.EntityFrameworkCore; |
| 6 | +using Microsoft.Extensions.DependencyInjection; |
| 7 | + |
| 8 | +namespace Host |
| 9 | +{ |
| 10 | + public class Startup |
| 11 | + { |
| 12 | + public void ConfigureServices(IServiceCollection services) |
| 13 | + { |
| 14 | + services.AddDbContext<IdentityDbContext>(opt => opt.UseInMemoryDatabase("test")); |
| 15 | + |
| 16 | + services.AddIdentity<IdentityUser, IdentityRole>(options => |
| 17 | + { |
| 18 | + options.Password.RequireDigit = false; |
| 19 | + options.Password.RequireLowercase = false; |
| 20 | + options.Password.RequireNonAlphanumeric = false; |
| 21 | + options.Password.RequireUppercase = false; |
| 22 | + options.Password.RequiredLength = 4; |
| 23 | + }) |
| 24 | + .AddEntityFrameworkStores<IdentityDbContext>() |
| 25 | + .AddDefaultTokenProviders(); |
| 26 | + |
| 27 | + services.AddIdentityManager() |
| 28 | + .AddIdentityMangerService<AspNetCoreIdentityManagerService<IdentityUser, string, IdentityRole, string>>(); |
| 29 | + } |
| 30 | + |
| 31 | + public void Configure(IApplicationBuilder app) |
| 32 | + { |
| 33 | + app.UseDeveloperExceptionPage(); |
| 34 | + |
| 35 | + app.UseRouting(); |
| 36 | + |
| 37 | + app.UseAuthentication(); |
| 38 | + app.UseAuthorization(); |
| 39 | + |
| 40 | + app.UseIdentityManager(); |
| 41 | + |
| 42 | + app.UseEndpoints(x => x.MapDefaultControllerRoute()); |
| 43 | + } |
| 44 | + } |
| 45 | +} |
0 commit comments