claimsprincipal_dotnet Authentication means identifying a subject (user, external application etc) ASP.Net Core Identity is a framework that uses claims based authentication to authenticate users Key concepts in Claims-based authentication Claim Claim is a statement about the subject (user) being authenticated It is a key value pair (like username=John is a claim, email=john1543@gmail.com is a claim, userId=236 is a claim) A claim can have an issuer (for example: userId=236 as per system , date of birth=1st-Jan-2006 as per Gmail ; here system and Gmail are the issuers) ClaimsIdentity ClaimsIdentity is a collection of claims of the subject (user) For example, driving license of a subject (user) can be a ClaimsIdentity that has claims like name, photo, date of birth, address etc. Passport can be a ClaimsIdentity that has claims like name, place of birth, photo, nationality, permanent address etc ClaimsIdentity also has a string property called Authenti...
dotnet_packages By using packages , third party logic can be used in dotnet applications Packages declaration in csproj file The external packages used by a project are declared in its csproj file like the following The packages will be downloaded and linked as per the csproj package references during the restore or build process Browse Nuget packages online Nuget packages can searched online at https://www.nuget.org/PACKAGES Manage packages from dotnet cli Install / update a package command - dotnet add <PROJECT_FOLDER> package <PACKAGE_NAME> -v <VERSION> The following command adds/updates a package in a project. If the package is already present, it will be updated to the latest version dotnet add package Microsoft.Data.Sqlite Install a specific version using -v flag like the following dotnet add package Microsoft.Data.Sqlite -v 8.0.10 List all packages in a project command - dotnet list <PROJECT_FOLDER> package ...
cookie_auth Cookie based authentication explained in ASP.NET Core Cookie based authentication can be implemented in ASP.NET Core using the built in Authentication service and Authentication middleware Add cookie authentication service in DI container // Add Cookie Authentication service builder . Services . AddAuthentication ( CookieAuthenticationDefaults . AuthenticationScheme ) . AddCookie ( options = > { options . LoginPath = "/Account/Login" ; // Specify the path to the login page options . AccessDeniedPath = "/Account/AccessDenied" ; // Specify the path for access denied options . ExpireTimeSpan = TimeSpan . FromMinutes ( 60 ) ; // Set the cookie expiration time options . SlidingExpiration = true ; // Enable sliding expiration } ) ; AddAuthentication adds required services for authentication. It also specifies the default authentication scheme to be used for authenticati...
Comments
Post a Comment