title: ASP.NET Core MVC identity - 3 users (admin, client, not logged in user). Set up controller only for client and not logged in user
body: <p>I have a shop app. There is a shopping cart option which is serviced by <code>ShoppingCartController</code>. I want all actions from this controller would be executed only if an user is not logged in or if is the client.</p>
  <p>To be clear:</p>
  <ul>
  <li><p>Not logged in user - an user that has no role and is not logged in</p>
  </li>
  <li><p>Client - an user that get &quot;Client&quot; role once he logs in and looses this role once he logs out. He does not have &quot;Admin&quot; role</p>
  </li>
  <li><p>Admin - an user that has &quot;Admin&quot; role, no matter if is logged in or out.</p>
  </li>
  </ul>
  <p>So something like:</p>
  <pre><code>[Authorize(Roles != &quot;Admin&quot;)]
  public class ShoppingCartController : Controller {} 
  </code></pre>
  <p>or</p>
  <pre><code>[Authorize(Roles = &quot;NotLoggedInUser, Client&quot;)]
  public class ShoppingCartController : Controller {} 
  </code></pre>