using DS.WMS.OpenAuth; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); // builder.Services.AddSwaggerGen(); builder.Services.AddIdentityServer() .AddDeveloperSigningCredential() .AddInMemoryIdentityResources(Config.IdentityResources) .AddInMemoryClients(Config.Clients) .AddInMemoryApiScopes(Config.ApiScopes) .AddInMemoryApiResources(Config.ApiResources) //.AddResourceOwnerValidator() //这句可以打开自主验证登录用户 // .AddTestUsers(new List()) //.AddProfileService() // .AddAspNetIdentity() .AddTestUsers(new List { new IdentityServer4.Test.TestUser { SubjectId="10001", Username ="port", Password ="!qweH%" // SubjectId="123", // Username = "alice", // Password = "alice", // Claims = new List() { // new Claim(JwtClaimTypes.Role, "superadmin"), // new Claim(JwtClaimTypes.Role, "admin") // } } }) ; var app = builder.Build(); // Configure the HTTP request pipeline. // if (app.Environment.IsDevelopment()) // { // app.UseSwagger(); // app.UseSwaggerUI(); // } app.MapGet("/", () => "Hello World!"); // app.UseHttpsRedirection(); app.UseIdentityServer(); app.UseAuthorization(); app.MapControllers(); app.Run();