This English blog post is Andrew Lock Written Introduction to Authentication with ASP.NET Core
<> .

Here are some simple reading notes:


ASP.NET Core The verification model of is claims-based authentication .Claim 
It is an expression of the characteristics of the verified subject, such as: Login user name yes... userId yes... Among them“ Login user name”,“email”,“ userId” NamelyClaimType.

You can think of claims as being a statement about...That statement consists
of a name and a value.

Corresponding to things in reality, For example, driver's license. Driver's license“ ID card No.:xxx” It is aclaim,“ Full name:xxx” It's another.claim.

a setclaims It forms aidentity, With theseclaims Ofidentity Namely ClaimsIdentity
, A driver's license is oneClaimsIdentity, Can handleClaimsIdentity Understood as“ Certificates”, A driver's license is a kind of certificate, Passport is also a kind of document.

ClaimsIdentity The owner of ClaimsPrincipal 
, OneClaimsPrincipal Can hold multipleClaimsIdentity, Like a person with a driver's license, With a passport.


UnderstoodClaim, ClaimsIdentity, ClaimsPrincipal These three concepts, To understand how to generate loginCookie Why use the following code?
var claimsIdentity = new ClaimsIdentity(new Claim[] { new
Claim(ClaimTypes.Name, loginName) },"Basic"); var claimsPrincipal = new
To useCookie Represents a validated subject, Must includeClaim, ClaimsIdentity,
ClaimsPrincipal These three messages, For example, a person with a legal driver's license,ClaimsPrincipal It's the one with the papers,ClaimsIdentity It's a document."Basic" Is the type of certificate( Let's say it's a driver's license),Claim It's the information in the driver's license.