Skip to main content

Posts

Showing posts from August, 2020

.Net Core Authentication Using JWT(JSON Web Token)

.Net Core application has many different authentication techniques like Cookie Authentication, Microsoft Identity Library, Identity Server 4, JWT, OAuth, etc. For a single page application that uses .Net Core Web Rest API, JWT is one of the simple and best approaches for performing token-based authentication.
Here we going to understand the integration of JWT authentication for .Net Core API with a sample implementation. Overview On JWT:JSON Web Token is a digitally signed and secured token for user validation. JWT is constructed with 3 informative parts like: HeaderPayloadSignature
Create A Sample .Net Core API:Let's create a sample .Net Core API application to implement the JWT authentication. You can use an editor like Visual Studio 2019(Supports .Net Core 3.0 plus) or Visual Studio Code. Add User.cs File:Let's add a User.cs file that represents a model of the user table(table will be integrated later steps). Data/Entities/User.cs: namespace JwtApiSample.Data.Entities { public…

Configuration And Working Mechanism Of JSON Files On .Net Core Application Starts

.Net Core application JSON file configuration technique has come into picture by replacing traditional way like Web.Config file approach. By default application loads "appSettings.json" file on startup. If we have defined environment variable then application also loads environmental specific json files like "appSettings.Development.json"(for environment variable is Development), "appSettings.Stage.json"(for environment variable is Stage), "appSettings.Production.json"(for environment variable is Production) along with the "appSetting.json".Create A Sample .Net Core Application:Now for better understanding let's walk through with a sample .Net Core Web API application. The application can be created either by using Visual Studio 2019(VS Editor supports .Net Core Version 3.0plus) or visual Studio Code App Loads appSettings.json And appSettings.{Environmental_Variable}.json By Default:On application start, appSettings.json and appSet…