Created
January 4, 2018 09:42
-
-
Save jmcd/778f1a45d7d17a12594e3e1e89ca0a53 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class Startup | |
{ | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddMvc(config => | |
{ | |
var requireAgent = new AuthorizationPolicyBuilder() | |
.RequireAuthenticatedUser() | |
.RequireRole(RoleNames.Agent) | |
.Build(); | |
config.Filters.Add(new AuthorizeFilter(requireAgent)); | |
}); | |
... | |
[AllowAnonymous] | |
public class HomeController : Controller | |
{ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment