123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using Id4;
- var builder = WebApplication.CreateBuilder(args);
- var services = builder.Services;
- // Add services to the container.
- builder.Services.AddControllersWithViews();
- services.AddIdentityServer(options =>
- {
- options.Events.RaiseErrorEvents = true;
- options.Events.RaiseInformationEvents = true;
- options.Events.RaiseFailureEvents = true;
- options.Events.RaiseSuccessEvents = true;
- })
- // in-memory, code config
- .AddTestUsers(InMemoryConfig.Users().ToList())
- .AddInMemoryApiResources(InMemoryConfig.GetApiResources())
- .AddInMemoryClients(InMemoryConfig.GetClients())
- .AddInMemoryApiScopes(InMemoryConfig.ApiScopes)
- .AddDeveloperSigningCredential();
- services.AddAuthentication();//ÅäÖÃÈÏÖ¤·þÎñ
- var app = builder.Build();
- // Configure the HTTP request pipeline.
- if (!app.Environment.IsDevelopment())
- {
- app.UseExceptionHandler("/Home/Error");
- }
- app.UseStaticFiles();
- app.UseRouting();
- app.UseIdentityServer();
- app.UseAuthorization();
- app.MapControllerRoute(
- name: "default",
- pattern: "{controller=Home}/{action=Index}/{id?}");
- app.Run();
|