Created
July 9, 2018 22:26
-
-
Save brunomartinspro/674dc944fdb3345671b5822250f8d7dd to your computer and use it in GitHub Desktop.
[ASP.NET Core] Deactivate default authentication challenge (Account/Login)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
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