Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wellingtonjhn/bda46b2ed9615ebba69091bb31f42b49 to your computer and use it in GitHub Desktop.
Save wellingtonjhn/bda46b2ed9615ebba69091bb31f42b49 to your computer and use it in GitHub Desktop.
Configure Authorize Filter ASP.Net MVC
public void ConfigureServices(IServiceCollection services)
{
// ... restante do método ocultado
services.AddMvc(config =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
config.Filters.Add(new AuthorizeFilter(policy));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment