December 2019
Intermediate to advanced
528 pages
11h 19m
English
In order to secure the API, we need to do just two things (neither of which requires IdentityServer – and one is already done for us!). The first is that we need to tell ASP.NET Core that we want to use authorization. In our startup file, we're already calling AddControllers. Because ASP.NET Core is now open source, we can simply look at what this does for us:
private static IMvcCoreBuilder AddControllersCore(IServiceCollection services){ return services .AddMvcCore() .AddApiExplorer() .AddAuthorization() .AddCors() .AddDataAnnotations() .AddFormatterMappings();}