Skip to content

Instantly share code, notes, and snippets.

@explorer14
Created May 3, 2018 19:02
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 explorer14/31fcaf1fc8a5aa1acc8537775eefd565 to your computer and use it in GitHub Desktop.
Save explorer14/31fcaf1fc8a5aa1acc8537775eefd565 to your computer and use it in GitHub Desktop.
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(options =>
{
// these must be set other ASP.NET Core will throw exception that no
// default authentication scheme or default challenge scheme is set.
options.DefaultAuthenticateScheme =
CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme =
CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie();
services.AddMvc(options => options.Filters.Add(new
RequireHttpsAttribute()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment