8000 Protect controllers with JWT by ThecoderPinar · Pull Request #4 · ThecoderPinar/CoreXCrudAPI · GitHub
[go: up one dir, main page]

Skip to content

Protect controllers with JWT #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Controllers/OrderDetailsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
using CoreXCrud.Repositories;
using FluentValidation;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;

namespace CoreXCrud.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class OrderDetailsController : ControllerBase
[Authorize] // 📌 JWT ile yetkilendirme ekledik
[Route("api/[controller]")]
[ApiController]
public class OrderDetailsController : ControllerBase
{
private readonly IUnitOfWork _unitOfWork;
private readonly IMapper _mapper;
Expand Down
8 changes: 5 additions & 3 deletions Controllers/OrdersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
using CoreXCrud.Repositories;
using FluentValidation;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Serilog;

namespace CoreXCrud.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class OrdersController : ControllerBase
[Authorize] // 📌 JWT ile yetkilendirme ekledik
[Route("api/[controller]")]
[ApiController]
public class OrdersController : ControllerBase
{
private readonly IUnitOfWork _unitOfWork;
private readonly IMapper _mapper;
Expand Down
8 changes: 5 additions & 3 deletions Controllers/UsersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
using CoreXCrud.Repositories;
using FluentValidation;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;

namespace CoreXCrud.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class UsersController : ControllerBase
[Authorize] // 📌 JWT ile yetkilendirme ekledik
[Route("api/[controller]")]
[ApiController]
public class UsersController : ControllerBase
{
private readonly IUnitOfWork _unitOfWork;
private readonly IMapper _mapper;
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,11 @@ https://localhost:7252/swagger

----------

## 📊 API Modülleri ve Uç Noktalar

### 🧑‍💼 1️⃣ Kullanıcı Yönetimi (Users)
## 📊 API Modülleri ve Uç Noktalar

> **Not:** `/api/Auth/login` haricindeki tüm uç noktalar JWT ile korunur. İsteklerinizde `Authorization: Bearer {token}` başlığını göndermeniz gerekir.

### 🧑‍💼 1️⃣ Kullanıcı Yönetimi (Users)

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

Expand Down
0