Skip to content

Commit 06f016e

Browse files
Merge pull request #4 from ThecoderPinar/codex/add-authorization-to-controllers
Protect controllers with JWT
2 parents 6d90b8d + 382f3f5 commit 06f016e

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

Controllers/OrderDetailsController.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
using CoreXCrud.Repositories;
55
using FluentValidation;
66
using Microsoft.AspNetCore.Mvc;
7+
using Microsoft.AspNetCore.Authorization;
78

89
namespace CoreXCrud.Controllers
910
{
10-
[Route("api/[controller]")]
11-
[ApiController]
12-
public class OrderDetailsController : ControllerBase
11+
[Authorize] // 📌 JWT ile yetkilendirme ekledik
12+
[Route("api/[controller]")]
13+
[ApiController]
14+
public class OrderDetailsController : ControllerBase
1315
{
1416
private readonly IUnitOfWork _unitOfWork;
1517
private readonly IMapper _mapper;

Controllers/OrdersController.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
using CoreXCrud.Repositories;
55
using FluentValidation;
66
using Microsoft.AspNetCore.Mvc;
7+
using Microsoft.AspNetCore.Authorization;
78
using Serilog;
89

910
namespace CoreXCrud.Controllers
1011
{
11-
[Route("api/[controller]")]
12-
[ApiController]
13-
public class OrdersController : ControllerBase
12+
[Authorize] // 📌 JWT ile yetkilendirme ekledik
13+
[Route("api/[controller]")]
14+
[ApiController]
15+
public class OrdersController : ControllerBase
1416
{
1517
private readonly IUnitOfWork _unitOfWork;
1618
private readonly IMapper _mapper;

Controllers/UsersController.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
using CoreXCrud.Repositories;
55
using FluentValidation;
66
using Microsoft.AspNetCore.Mvc;
7+
using Microsoft.AspNetCore.Authorization;
78

89
namespace CoreXCrud.Controllers
910
{
10-
[Route("api/[controller]")]
11-
[ApiController]
12-
public class UsersController : ControllerBase
11+
[Authorize] // 📌 JWT ile yetkilendirme ekledik
12+
[Route("api/[controller]")]
13+
[ApiController]
14+
public class UsersController : ControllerBase
1315
{
1416
private readonly IUnitOfWork _unitOfWork;
1517
private readonly IMapper _mapper;

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,11 @@ https://localhost:7252/swagger
177177

178178
----------
179179

180-
## 📊 API Modülleri ve Uç Noktalar
181-
182-
### 🧑‍💼 1️⃣ Kullanıcı Yönetimi (Users)
180+
## 📊 API Modülleri ve Uç Noktalar
181+
182+
> **Not:** `/api/Auth/login` haricindeki tüm uç noktalar JWT ile korunur. İsteklerinizde `Authorization: Bearer {token}` başlığını göndermeniz gerekir.
183+
184+
### 🧑‍💼 1️⃣ Kullanıcı Yönetimi (Users)
183185

184186
Kullanıcı yönetimi API'si, sistemdeki kullanıcıları yönetmek için kullanılır.
185187

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy