ASP .NET Core Web API - Basic Authentication + Entity Framework in Tamil || nihira techiees

preview_player
Показать описание

This video explains basic authentication in ASP .NET Core Web API

Steps need to be proceed
======================
2, Create Authentication handler
3, implement the handler using AuthenticationHandler with AuthenticationSchemeOptions
4, Add Required namespace
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Logging;
using System.Text.Encodings.Web;
5, Get Authorization header using AuthenticationHeaderValue
6, Inject the DB Context to the handler
7, Access the user table validate the credentials if all matched
8, Create Ticket & return the response

Code for create Ticket
==================
var claims = new[] { new Claim(ClaimTypes.Name, _userinfo.Userid) };
var identity = new ClaimsIdentity(claims, Scheme.Name);
var principal = new ClaimsPrincipal(identity);
var ticket = new AuthenticationTicket(principal, Scheme.Name);

Url for Encoding
===============
Рекомендации по теме
Комментарии
Автор

Very good explanation, it helped me to setup authentication for the web api project 👏👍👍

nisarahamed
Автор

I want to use jwt authentication for some method and basic authentication for some other. So if I give [Authorize] how can I differentiate between the two types of authentication

hhcruz
Автор

bro iss deployment is needed for this bro follow all ur steps but dont know why this error came nu
Bro error came in program.cs file
System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Lifetime: Transient ImplementationType:
pls give the solution to solve this bro

gladisxavier
Автор

Bro error came in program.cs file
System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Lifetime: Transient ImplementationType:
pls give the solution to solve this bro

gladisxavier
Автор

System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Lifetime: Transient ImplementationType: Unable to resolve service for type while attempting to activate

InvalidOperationException: Unable to resolve service for type while attempting to activate

(pls solve this issue bro i followed all ur steps without solve this error cant move next level bro so pls)

gladisxavier
Автор

bro follow all this video steps and checked again also but still the same error only came bro pls solve this issue bro
in my program.cs the error shown in bro
public static void Main(string[] args)
{

}

gladisxavier
Автор

Thanks anna inum advance concept soili thaga anna

meta
Автор

Hi bro, Asp.net core and web api based real time application with company architecture pattern pls

anbuanbu