Overview
SYNTIweb uses Laravel Breeze with session-based authentication. All authentication endpoints use Laravel’s built-in session management with CSRF token protection. The system provides:- User registration and login
- Password reset functionality
- Email verification
- Session management
- Rate limiting on authentication attempts
Authentication Type
Session-based authentication using Laravel’s web guard with database session storage.Sessions are stored in the database by default
Session lifetime in minutes (2 hours)
Cookie name:
{APP_NAME}-session (e.g., syntiweb-session)CSRF Protection
All state-changing requests (POST, PUT, DELETE) require a valid CSRF token. Laravel automatically handles CSRF protection for web routes.Getting a CSRF Token
CSRF tokens are automatically included in forms when using Blade templates. For JavaScript applications:Registration
Create a new user account. Endpoint:POST /register
Middleware: guest (unauthenticated users only)
Request Parameters
User’s full name (max 255 characters)
User’s email address (must be unique, lowercase, valid email format)
User’s password (must meet Laravel’s default password requirements)
Password confirmation (must match password)
Business industry segment. Must be one of:
FOOD_BEVERAGERETAILHEALTH_WELLNESSPROFESSIONAL_SERVICESON_DEMAND
Example Request
Response
Redirects to
/dashboard on successSession data including:
- Authenticated user session
pending_industry_segmentstored for tenant creation flow
Implementation Details
The registration process (routes/auth.php:15-18, app/Http/Controllers/Auth/RegisteredUserController.php:32-55):- Validates input fields
- Creates user with hashed password
- Stores
industry_segmentin session for tenant setup - Fires
Registeredevent - Automatically logs in the user
- Redirects to dashboard
Login
Authenticate an existing user. Endpoint:POST /login
Middleware: guest (unauthenticated users only)
Request Parameters
User’s email address
User’s password
Enable “remember me” functionality to extend session lifetime
Example Request
Response
Redirects to intended URL or
/dashboard on successAuthenticated user session with regenerated session ID
Rate Limiting
Login attempts are rate-limited to prevent brute force attacks (app/Http/Requests/Auth/LoginRequest.php:62-78):Maximum login attempts allowed
Based on email address and IP address
Example Error Response
Logout
Destroy the authenticated session. Endpoint:POST /logout
Middleware: auth (authenticated users only)
Example Request
Response
Redirects to
/ (homepage)Implementation Details
The logout process (app/Http/Controllers/Auth/AuthenticatedSessionController.php:39-48):- Logs out the user from the
webguard - Invalidates the session
- Regenerates the CSRF token
- Redirects to homepage
Password Reset
Request Password Reset Link
Send a password reset link to the user’s email. Endpoint:POST /forgot-password
Middleware: guest
Request Parameters
User’s email address
Example Request
Response
Success message: “We have emailed your password reset link!”
Reset Password
Reset the user’s password using the token from the email. Endpoint:POST /reset-password
Middleware: guest
Request Parameters
Password reset token from email link
User’s email address
New password (must meet Laravel’s password requirements)
Password confirmation (must match password)
Example Request
Response
Redirects to
/login with success statusConfiguration
Password reset tokens expire after 60 minutes (config/auth.php:97).Update Password
Update the password for an authenticated user. Endpoint:PUT /password
Middleware: auth (authenticated users only)
Request Parameters
User’s current password
New password (must meet Laravel’s password requirements)
Password confirmation (must match password)
Example Request
Response
Returns “password-updated” on success
Email Verification
Check Verification Status
Display the email verification prompt. Endpoint:GET /verify-email
Middleware: auth
Verify Email
Verify the user’s email address using the signed URL from the verification email. Endpoint:GET /verify-email/{id}/{hash}
Middleware: auth, signed, throttle:6,1
URL Parameters
User ID
Hash of the user’s email address
Rate Limiting
Limited to 6 attempts per minute.Resend Verification Email
Send a new verification email to the user. Endpoint:POST /email/verification-notification
Middleware: auth, throttle:6,1
Example Request
Rate Limiting
Limited to 6 attempts per minute.Middleware & Protected Routes
Authentication Middleware
To protect routes, use theauth middleware:
Middleware Configuration
Authentication middleware is automatically configured in Laravel 11 (bootstrap/app.php:14-19).Guest Middleware
Redirect authenticated users away from guest-only pages:Checking Authentication Status
In controllers or routes:Middleware in Blade Views
Session Management
Session Configuration
Sessions are configured in config/session.php:Session storage driver
Session lifetime in minutes
Expire session when browser closes
Encrypt session data
Prevent JavaScript access to session cookie
SameSite cookie attribute for CSRF protection
Session Regeneration
Sessions are automatically regenerated on login to prevent session fixation attacks (app/Http/Controllers/Auth/AuthenticatedSessionController.php:31).Accessing Session Data
Security Considerations
CSRF Protection
All POST, PUT, PATCH, and DELETE requests must include a valid CSRF token. Laravel automatically verifies CSRF tokens for all routes.Password Requirements
Passwords must meet Laravel’s default requirements:- Minimum 8 characters (configurable)
- Mix of letters, numbers, and symbols recommended
Rate Limiting
- Login: 5 attempts per email+IP combination
- Email verification: 6 attempts per minute
- Password reset: 60 second throttle between requests
Session Security
- HttpOnly cookies prevent XSS attacks
- SameSite attribute set to “lax” for CSRF protection
- Session ID regenerated on login
- Session invalidated on logout
Additional Security
- Content Security Policy middleware enabled (bootstrap/app.php:15)
- Passwords hashed using bcrypt
- Remember tokens regenerated on password reset
Authentication Guard
SYNTIweb uses the defaultweb guard configured for session-based authentication (config/auth.php:38-43):
App\Models\User model.