1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using Microsoft.AspNetCore.Builder;
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.DependencyInjection;
- namespace CasinosManager.IdentityServer
- {
- public class Startup
- {
- // This method gets called by the runtime. Use this method to add services to the container.
- // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddIdentityServer()
- .AddDeveloperSigningCredential()
- .AddInMemoryApiResources(Config.GetApiResources())
- .AddInMemoryClients(Config.GetClients())
- .AddResourceOwnerValidator<AccountValidator>();
- //.AddTestUsers(Config.GetUsers());
- services.AddCors(options =>
- {
- options.AddPolicy("angular", policy =>
- {
- policy.WithOrigins("http://localhost:3000")
- .AllowAnyHeader()
- .AllowAnyMethod()
- .AllowCredentials();
- });
- });
- }
- // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
- public void Configure(IApplicationBuilder app, IHostingEnvironment env)
- {
- if (env.IsDevelopment())
- {
- app.UseDeveloperExceptionPage();
- }
- app.UseIdentityServer();
- app.UseCors("angular");
- app.Run(async (context) =>
- {
- await context.Response.WriteAsync("CasinosManager.IdentityServer!");
- });
- }
- }
- }
|