JWT authentication (ASP.NET)
Në shqip: Autentikimi me JWT në ASP.NET
ShpjegimiSQ
Me AddAuthentication().AddJwtBearer(), API-ja pranon token-a JWT. Vendos [Authorize] mbi controller ose endpoint, dhe vetëm kërkesat me token të vlefshëm kalojnë.
EnglishEN
With AddAuthentication().AddJwtBearer(), the API accepts JWT tokens. Put [Authorize] on a controller or endpoint, and only requests with a valid token get through.
Si ta mendosh
Si byzylyku i festivalit që e tregon te çdo portë.
Lexoje në anglisht
Like a festival wristband you show at every gate.
Shembull kodicsharp
[Authorize(Roles = "Mesues")]
[HttpPost]
public IActionResult VendosNoten(NotaDto dto) => Ok();