Posts

Showing posts from March, 2017

Solved: Jwt Authentication in Asp.Net Web Api And Mvc

Jwt in Asp.Net Web API And MVC
Introduction
Token based security is trending everywhere in today’s security architecture. There are different token providers out there, but the one people are more familiar with is the JWT token.

The token identifies a user. For example, your ID card could be used as a token. It identifies who you claim to be. The Id card would contain information like: ·Firstname·Lastname·Age·Title
The JSON Web Token
The JSON Web Token contains some header information, a signature, and the token’s claims. In plain
text, the claims might look like this:
{
"Name":"John doe",
"UserId":5,
"Email":"johndoe@gmail.com",
"Role":"Boss"
}
The token header is used to specify some other things like signature algorithm, expiration date, the name of the issuer, and a few other attributes.

Using Jwt In Asp.Net Web API

The JwtAuthHandler class is a custom class that inherits the DelegatingHandler class which handles the processin…