Overview
Kin Conecta uses a combination of Spring Security and BCrypt password encoding for user authentication. The current implementation provides basic authentication with endpoints for user login and registration.The authentication system is currently configured to permit all requests for development. Implement proper JWT or session-based authentication before production deployment.
Security Configuration
The API is configured with Spring Security using the following settings:Password Encoding
Passwords are hashed using BCrypt algorithm with automatic salt generation:CSRF Protection
CSRF protection is currently disabled for API endpoints:Request Authorization
All endpoints currently permit unrestricted access:User Model
The User entity contains the following authentication-related fields:Unique user identifier (auto-generated)
User’s email address (unique)
BCrypt hashed password
User role:
TOURIST, GUIDE, or ADMINAccount status:
ACTIVE, SUSPENDED, PENDING_VERIFICATION, or DEACTIVATEDUser’s full name
Phone number in E.164 format
Timestamp of email verification
Timestamp of last successful login
Account creation timestamp
Last account update timestamp
Authentication Endpoints
User Login
Authenticate a user with email and password.POST /kinconecta/api/user/login
Request Body:
User’s email address
User’s password (will be validated against BCrypt hash)
The current implementation returns a boolean. Consider implementing JWT tokens for stateless authentication.
User Registration
Create a new user account.POST /kinconecta/api/user
Request Body:
User’s complete name
User’s email address (must be unique)
User’s password (will be hashed with BCrypt)
User role:
TOURIST, GUIDE, or ADMINDate of birth in format:
YYYY-MM-DDISO 3166-1 alpha-2 country code (e.g.,
US, MX, ES)Phone number without country code
Phone number in E.164 format (e.g.,
+525512345678)Preferred language code:
EN, ES, FR, DE, IT, PTAccount status:
ACTIVE, PENDING_VERIFICATION, SUSPENDED, DEACTIVATEDUser Management Endpoints
Get All Users
Retrieve a list of all registered users.GET /kinconecta/api/user
Response:
Get User by ID
Retrieve a specific user by their ID.GET /kinconecta/api/user/{fullName}_{userId}
Path Parameters:
User’s full name (URL encoded if contains spaces)
User’s unique identifier
Update User
Update user information.PUT /kinconecta/api/user/{fullName}_{userId}
Delete User
Delete a user account.DELETE /kinconecta/api/user/{fullName}_{userId}
Response:
Returns the deleted user object.
Notifications
Add Notification to User
Add a notification to a user’s notification list.POST /kinconecta/api/user/{userId}/add-notification
Path Parameters:
User’s unique identifier
Notification title
Notification message content
Notification type (e.g.,
BOOKING, MESSAGE, REVIEW)Security Best Practices
1. Implement JWT Authentication
Replace boolean authentication response with JWT tokens:2. Add Request Validation
3. Implement Role-Based Access Control
4. Add Rate Limiting
Implement rate limiting for authentication endpoints:5. Secure Password Requirements
Enforce strong password policies:- Minimum 8 characters
- At least one uppercase letter
- At least one lowercase letter
- At least one number
- At least one special character
6. Enable HTTPS
Configure SSL/TLS certificates:7. Implement Email Verification
Add email verification flow:8. Add Session Management
Implement proper session timeout and management:Error Codes
| Code | Message | Description |
|---|---|---|
AUTH001 | Invalid credentials | Email or password is incorrect |
AUTH002 | Account not verified | Email verification required |
AUTH003 | Account suspended | Account has been suspended |
AUTH004 | Account deactivated | Account has been deactivated by user |
AUTH005 | Email already exists | Email is already registered |
AUTH006 | Weak password | Password does not meet security requirements |
AUTH007 | Token expired | Authentication token has expired |
AUTH008 | Invalid token | Authentication token is invalid |
Next Steps
API Overview
Return to API overview and explore other endpoints
User Profiles
Learn about tourist and guide profile management
Security Configuration
Deep dive into security implementation
JWT Implementation
Guide to implementing JWT authentication