aspnet / Templating

[Archived] ASP.NET Core templates for .NET CLI and Visual Studio. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
205 stars 79 forks source link

The new ReactRedux Template does not come with a HomeController. How do I force user to authenticate from the server? #441

Closed larry-lau closed 6 years ago

larry-lau commented 6 years ago

I am using AzureAd. How do I force user to authentication? I don't have the HomeController where I used to attach an AuthorizeAttribute.

Any built in support for this before I head down the middleware path?

Thanks

mkArtakMSFT commented 6 years ago

Hi. It looks like this is a question about how to use ASP.NET Core. While we do our best to look through all the issues filed here, to get a faster response we suggest posting your questions to StackOverflow using the asp.net-core-mvc tag.

mkArtakMSFT commented 6 years ago

@larry-lau, you can configure AuthorizationFilter on global level in Startup to enforce authentication on all your requests: https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-2.0#authorization-filters

The following StackOverflow question has an answer with a sample code which covers some aspects of it: https://stackoverflow.com/questions/35825021/override-global-authorize-filter-in-asp-net-core-mvc-1-0