Skip to content

Instantly share code, notes, and snippets.

@scottsauber
Created January 18, 2020 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottsauber/5792b2063cc6f408c36628ac07ee64b2 to your computer and use it in GitHub Desktop.
Save scottsauber/5792b2063cc6f408c36628ac07ee64b2 to your computer and use it in GitHub Desktop.
// OLD WAY FROM ASP.NET CORE PRIOR TO 3.0!!!!!!!!!
public class Startup
{
// Other Startup code omitted
public void ConfigureServices(IServiceCollection services)
{
// OLD WAY FROM ASP.NET CORE PRIOR TO 3.0!!!!!!!!!
services.AddMvc(options =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
options.Filters.Add(new AuthorizeFilter(policy));
});
// Other service registrations omitted
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment