Menu

Post image 1
Post image 2
Post image 3
Post image 4
Post image 5
1 / 5
0

Cookie based authentication & authorization in ASP.NET Core explained

DEV Community·Nagasudhir Pulla·23 days ago
#j12GtABy
#path#phase#steps#csharp#authentication#user
Reading 0:00
15s threshold

Video - https://youtu.be/GhZLi8pBJow?si=mnIVpCke9OJBMFoJ Services for Authentication and Authorization Authentication Service Maintains multiple authentication schemes Uses Cookie handler to Build ClaimsPrincipal from cookie, set up request redirection for login, logout, access denial Add cookie authentication service in DI container using the following // 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 }); Enter fullscreen mode Exit fullscreen mode AddAuthentication adds the authentication service to DI container.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More