From the course: Securing ASP.NET Core Apps: Advanced Techniques for Web Application Security
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Simple authentication with [Authorize] attribute - ASP.NET Core Tutorial
From the course: Securing ASP.NET Core Apps: Advanced Techniques for Web Application Security
Simple authentication with [Authorize] attribute
- [Instructor] The simple authentication type is about just checking if the user is logged in or not. And that is easily done by using the authorize attribute. Before we check how to add the authorize attribute, let us go to Visual Studio and check how the default configuration of the ASP.NET identity is done. In Visual Studio let us start with the solution explorer and then in here go to the Program.cs. In here in line eight, you're going to see that we do use the configuration GetConnectionString method to get the default connection. And if that doesn't exist then we just throw an exception which says Connection string is not found. Where can we find the default connection? To find that connection, go to the solution explorer. Then go to the appsettings.json file. In here you have the connection strings, so here when you have builder.configuration.GetConnectionString, this method will automatically search for a section…
Contents
-
-
-
-
(Locked)
What is authentication?1m 31s
-
(Locked)
Identity on ASP.NET Core5m 46s
-
(Locked)
Simple authentication with [Authorize] attribute5m 56s
-
(Locked)
Cookie-based authentication6m 49s
-
(Locked)
Social media provider authentication8m 33s
-
(Locked)
Email account verification10m 21s
-
(Locked)
API-key authentication7m 10s
-
(Locked)
Token-based authentication2m 16s
-
(Locked)
-
-