Skip to content

Instantly share code, notes, and snippets.

@brunomartinspro
Created July 9, 2018 22:26
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 brunomartinspro/674dc944fdb3345671b5822250f8d7dd to your computer and use it in GitHub Desktop.
Save brunomartinspro/674dc944fdb3345671b5822250f8d7dd to your computer and use it in GitHub Desktop.
[ASP.NET Core] Deactivate default authentication challenge (Account/Login)
...
namespace BrunoMartinsPro.Startup
{
public class Startup
{
...
public Startup(IHostingEnvironment env)
{
...
}
public void ConfigureServices(IServiceCollection services)
{
...
//when adding an identity if AutomaticChallenge is not specified,
//the middleware will redirect requests to "Account/Login" when authentication is required
services.AddIdentity<ApplicationUser, IdentityRole>(config => {
config.Cookies.ApplicationCookie.AutomaticChallenge = false;
});
...
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment