title: Redirecting on Authorize
body: <p>I've prepared the authentication like this in my <em>Start.cs</em>.</p>
  
  <pre><code>...
  services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddJwtBearer(a =&gt; a.TokenValidationParameters = new TokenValidationParameters
    {
      ValidateIssuer = true,
      ValidateAudience = true,
      ValidateLifetime = true,
      ValidateIssuerSigningKey = true,
      ValidIssuer = "beep",
      ValidAudience = "bopp",
      IssuerSigningKey = new SymmetricSecurityKey(
      Encoding.UTF8.GetBytes("SecurityKeyOfProperLength"))
    });
  ...
  </code></pre>
  
  <p>When I decorate one of the methods in my controller using <em>[Authorize]</em> attribute, I no longer get the view it points to rendered. Instead, just as expected, I get 401 Unauthorized.</p>
  
  <p>The next step I want to do is to be redirected to my login page, which is located in the controller <em>Security</em> and method <em>Login</em>. I don't know how to achieve it properly with no Q&amp;D.</p>
  
  <p>What I've tried to do is to google, of course, and I've found out a lot of examples on how to handle that from SPA. In my case it's good, old, plain MVC rendered on the backend so that's not applicable, as far I understand.</p>
  
  <p>I've also seen that I can override <em>OnChallenge</em> but it wasn't recommended.</p>
  
  <p>A bunch of links referred to 3rd parties like IDS and such. In my case, I want to learn the process and control it by micromanagement, at least for now. Mostly, because I want to learn that in depth.</p>
  
  <p>How do I configure my <em>AddAuthentication</em> so that it bounces the user to the right controller and method (still using best practices)? A few hints on terms to look for would by great - I'm not lazy, just careful and uncertain of what's good stuff and what's other confused bloggers' production.</p>