🔐 Kimlik Doğrulama Gerektiren Route'lar
Bu metotlar, kimlik doğrulama gerektiren route'lar tanımlamanızı sağlar. Bu route'lara yalnızca oturum açmış kullanıcılar erişebilir.
auth.page(path, controller)
Kimlik doğrulama gerektiren bir sayfa route'u tanımlar.
// Only authenticated users can access the dashboard
Odac.Route.auth.page('/dashboard', 'dashboard.index');
auth.page(path, viewConfig)
Kimlik doğrulama gerektiren, controller'sız bir sayfa route'u tanımlar.
// Only authenticated users can see this view
Odac.Route.auth.page('/profile', {
skeleton: 'main',
head: 'profile.head',
content: 'profile',
script: 'profile'
});
auth.get(path, controller, options)
Kimlik doğrulama gerektiren bir GET route'u tanımlar.
// API endpoint for authenticated users only
Odac.Route.auth.get('/api/user/profile', 'api.user.profile');
auth.post(path, controller, options)
Kimlik doğrulama gerektiren bir POST route'u tanımlar.
// Only authenticated users can update their profile
Odac.Route.auth.post('/api/user/update', 'api.user.update');
CSRF Belirteç Koruması
Varsayılan olarak tüm POST ve GET route'larında CSRF belirteç koruması etkindir. Bunu token seçeneği ile devre dışı bırakabilirsiniz:
// Disable CSRF token check for this route
Odac.Route.auth.post('/api/webhook', 'api.webhook', {token: false});