I have a question regarding authentication in ASP.NET Core 2: what exactly is the call app.UseAuthentication() for?
Is it a basic prerequisite so t
You do need to call it.
UseAuthentication() is documented as:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.authappbuilderextensions.useauthentication?view=aspnetcore-2.0
Adds the AuthenticationMiddleware to the specified IApplicationBuilder, which enables authentication capabilities.
It basically does this:
IApplicationBuilder AddAuthentication(this IApplicationBuilder app) {
return app.UseMiddleware();
}
...so it's just saving you some typing and possibly some extra using imports.
This adds an AuthenticationMiddleware instance into the process' request-handling pipeline, and this particular object adds the plumbing for authentication.