Aspnetcore.docs: authentication related questions/gaps

Created on 27 Apr 2018  路  2Comments  路  Source: dotnet/AspNetCore.Docs

The Angular template for dot net core project in Visual Studio has authentication turned off. Given the fact that authentication is essential this would seem like an important requirement. Any guidance or documentation with regard to using windows authentication and using logged on users id in components would be very useful.

Similarly if one uses a custom authentication scheme (or Siteminder which sends authenticated users information in request headers) is there a way to pass this info to javascript and angular without resorting to server side rendering (which requires nodejs installation on deployment server). Again a clear code example demonstrating passing of data from C# to Angular components would be very helpful.

All 2 comments

@SteveSandersonMS can you respond?

Generally we recommend keeping the server and client code independent, and having the client fetch whatever data it needs from an API endpoint on the server. For auth, the client can make a request to the server containing credentials, and then the server can respond either with a cookie or something like a JWT token that the client can include in subsequent requests to the server. We don't have a specific sample but that's the typical pattern people use with Angular/React/Vue-type apps, not just with ASP.NET Core but with any server backend.

Was this page helpful?
0 / 5 - 0 ratings