Friday, December 27, 2019

UseAuthentification() and UseAuthorization differences in ASP.NET core 3.0

In the past few days struggling with implementing login on ASP.NET core 3.1 with razor
i have tried to use identityserver4 but it provides MVC template rather than razor. I actually got a simple example running but using it further has met with problems. Hence i decide to write some simple finding

what are the differences between authentication and authorization ?

app.UseAuthentication();
app.UseAuthorization();

in simple meaning,
authentication means we check a user is login or not
after login, we use policy to check the user claim and role whether they are authorized to access certain method
example role is Guest , Admin
example claim is email address, name

i put the reference here about authentification
https://visualstudiomagazine.com/articles/2019/04/01/aspnet-core-security.aspx
https://visualstudiomagazine.com/articles/2019/10/24/aspnet-core-security-2.aspx

An article on https://visualstudiomagazine.com/articles/2019/10/29/aspnet-authentication.aspx explains authorization nicely.

No comments: