问题
I have a solution that contains 2 dot net core projects :
- Web API
- Web Application(MVC)
The web application is a web API consumer. My web application controller will use httpclient
for getting data and I use razor for the client (no Javascript library such as Angular). I want to use Microsoft identity
for authentication and recently I have read about JWT
.
In which project should I add Microsoft Identity? (Because we need authentication for building a token in JWT
)
If I must add it in the Web API
project, how can I use identity when I need authentication in razor-- or somewhere else in the MVC project-- using User.Identity.IsAuthenticated
or usermanager
?
来源:https://stackoverflow.com/questions/52896967/use-one-identity-for-webapi-and-asp-net-core-in-different-projects