Proje: Okul Platform · Hub: Okul Platform — Conventions
Middleware Listesi (app/Http/Middleware/)
Auth & Identity
| Middleware | Açıklama |
|---|---|
IdentifyCustomer | B2B bağlamı kur: x-cid header → customer + customerUser |
UserGroupTypeMiddleware | user_group_type kontrolü: admin/user/customer |
OptionalAuth | optional.auth:sanctum — Login zorunlu değil |
WebhookAuthMiddleware | External webhook auth (Sonitel) |
MigrationWebhookMiddleware | Migration webhook auth |
Security
| Middleware | Açıklama |
|---|---|
VerifyConsumerToken | x-consumer-key header kontrolü (PlatformType token’ları) |
VerifyCsrfToken | CSRF token doğrulama |
ValidateSignature | URL imzası doğrulama |
EncryptCookies | Cookie şifreleme |
Request Processing
| Middleware | Açıklama |
|---|---|
CastBooleans | String boolean değerleri gerçek bool’a çevir |
DetectLocale | Dil tespiti |
TrimStrings | String trim |
TrustHosts | Güvenilir host listesi |
TrustProxies | Proxy güvenilirliği |
PreventRequestsDuringMaintenance | Bakım modu koruması |
VerifyConsumerToken
x-consumer-key header’ı gerektirir. Geçerli tokenlar:
config('consumer.web')— Web frontendconfig('consumer.crm')— CRM panelconfig('consumer.customer')— B2B portalconfig('consumer.swagger_ui')— Swagger UI
Bu token hangi platform’dan istek geldiğini doğrular.
UserGroupTypeMiddleware Kullanımı
Route::middleware('user_group_type:admin')->group(...)
Route::middleware('user_group_type:customer')->group(...)Related
- api-route-structure — Route’larda middleware kullanımı
- api-identify-customer-middleware — IdentifyCustomer detayı
- api-auth-system — Auth akışı