.NET core 2.0 cookie authentication - do not redirect

Viewed 4622

I am using .NET core 2.0 with cookie authentication.
My configuration looks like this:

services
  .AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
  .AddCookie(options =>
  {
      options.ExpireTimeSpan = TimeSpan.FromDays(1);
      options.SlidingExpiration = true;
      options.Cookie.Name = "authtoken";
  });

When I access unauthorized controller, I am being redirected to /Account/Login

In .NET Core 1.1 I was able to configure this by setting AutomaticChallenge = false.
How can I configure this in .NET Core 2.0?
I just want my controller to return HTTP 403.

1 Answers
Related