Overview
The Tournament Management App uses ASP.NET Core Identity for secure user authentication and authorization. This system protects tournament management features and ensures only authorized users can create, modify, or delete tournament data.Authentication System
The application implements Microsoft’s ASP.NET Core Identity framework, providing:- User registration and account creation
- Secure login with password hashing
- Email confirmation for new accounts
- Account lockout protection against brute-force attacks
- Session management
- User role-based authorization
Database Configuration
The authentication system uses SQLite for user data storage:- IdentityDataContext: EF Core database context for Identity tables
- SQLite Database: Stores user accounts, passwords, and authentication data
- Environment Variable Support: Configurable connection string via
DATABASE_CONNECTION_STRING
User Registration
Access Registration Page
Navigate to the registration page (typically
/Identity/Account/Register).No authentication required to access this page.Enter Account Information
Fill in the registration form with required details:Email Address (Correo electrónico)
- Required field
- Must be valid email format
- Used as username in the system
- Cannot be an email already registered
- Minimum 6 characters
- Maximum 100 characters
- Must meet complexity requirements (see Password Policy below)
- Must exactly match the password field
- Prevents typos during registration
Submit Registration
The system validates your input:
- Checks if email is already in use
- Validates password meets security requirements
- Ensures password confirmation matches
Email Confirmation
After successful registration:
- A confirmation email is sent to your address
- Email contains a confirmation link
- Click the link to confirm your account
- Account confirmation is required before you can log in
The system is configured with
RequireConfirmedAccount = true, meaning you must confirm your email before accessing protected features.User Login
Password Policy
The application enforces strict password requirements for security:Password Complexity Requirements
Password Complexity Requirements
Configured in Requirements:
Program.cs:- Minimum Length: 6 characters
- Requires Digit: At least one number (0-9)
- Requires Lowercase: At least one lowercase letter (a-z)
- Requires Uppercase: At least one uppercase letter (A-Z)
- Requires Non-Alphanumeric: At least one special character (!@#$%^&*, etc.)
- Unique Characters: At least 1 unique character
Password123!MyTorneo2026#Secure@Pass1
password(no uppercase, digit, or special char)Pass1!(too short, only 6 chars but missing complexity)PASSWORD123!(no lowercase)
Account Lockout Protection
The system protects against brute-force attacks with automatic account lockout:- Failed Attempts Limit: 5 consecutive failed login attempts
- Lockout Duration: 5 minutes
- Applies To: All users including newly registered accounts
Authorization Levels
The application uses two authorization levels:Anonymous Access (No Login Required)
Users can view tournament data without authentication:- Browse teams
- View players
- See match schedules and results
- View technical directors and municipalities
Authenticated Access (Login Required)
The[Authorize] attribute protects management features:
Protected Pages:
- Team creation, editing, and deletion (
Pages/Equipos/Create,Edit) - Player management (
Pages/Jugadores/Create,Edit) - Match scheduling and editing (
Pages/Partidos/Create,Edit) - Technical director management (
Pages/DTs/Create,Edit)
Identity Configuration
The authentication system is configured inProgram.cs:
- User Type:
IdentityUser(standard ASP.NET Core Identity user) - Email Confirmation: Required (
RequireConfirmedAccount = true) - Store: Entity Framework Core with SQLite database
- Framework: ASP.NET Core Identity (default implementation)
Data Protection
User data and authentication tokens are protected using ASP.NET Core Data Protection:- Key Persistence: Encryption keys stored in database
- Application Name: “TorneoApp” (ensures keys are application-specific)
- Purpose: Protects cookies, tokens, and sensitive data
Data protection keys are persisted to the database context, ensuring they survive application restarts and work in multi-server deployments.
Registration Process Flow
Login Process Flow
Common Authentication Errors
Email Already in Use
Email Already in Use
Error: “El correo electrónico ya está en uso.”Cause: The email address is already registered in the system.Solution:
- Use a different email address
- Or log in with existing account if you already registered
- Or use password recovery if you forgot your password
Passwords Don't Match
Passwords Don't Match
Error: “Las contraseñas no coinciden.”Cause: Password and Confirm Password fields don’t match exactly.Solution:
- Carefully re-enter both password fields
- Ensure no extra spaces or typos
- Make both fields identical
Password Too Weak
Password Too Weak
Error: “La contraseña debe tener entre 6 y 100 caracteres.”Cause: Password doesn’t meet complexity requirements.Solution:
- Use at least 6 characters
- Include uppercase letter (A-Z)
- Include lowercase letter (a-z)
- Include digit (0-9)
- Include special character (!@#$%^&*)
Account Locked Out
Account Locked Out
Cause: Too many failed login attempts (5 or more).Solution:
- Wait 5 minutes for lockout to expire
- Verify you’re using the correct password
- Consider using password recovery if you’ve forgotten credentials
Email Not Confirmed
Email Not Confirmed
Cause: Trying to log in before confirming email address.Solution:
- Check your email inbox for confirmation message
- Click the confirmation link in the email
- Check spam/junk folder if email not found
- Request new confirmation email if needed
Security Features
Password Hashing
Passwords are never stored in plain text. ASP.NET Core Identity uses industry-standard hashing algorithms.
HTTPS Redirection
The application enforces HTTPS in production to encrypt data in transit.
Anti-Forgery Tokens
Forms are protected with anti-forgery tokens to prevent CSRF attacks.
Session Management
Secure session handling with configurable timeout and cookie settings.
Health Checks
The application includes health monitoring for the authentication database:/health
Purpose:
- Monitor database connectivity
- Verify authentication system is operational
- Support deployment health checks
Logout
Users can log out to end their authenticated session:- Click the logout link in the navigation
- Session is terminated
- Authentication cookie is cleared
- User is redirected to home page
- Must log in again to access protected features
Future Authentication Features
The codebase includes commented-out configuration for external authentication providers:Best Practices
Strong Passwords
Use unique, complex passwords that meet all requirements. Consider a password manager.
Confirm Email Promptly
Check your email and confirm your account immediately after registration.
Logout When Done
Always log out when finished managing tournament data, especially on shared computers.
Avoid Failed Attempts
Be careful entering credentials to avoid triggering account lockout.
Related Documentation
Team Management
Requires authentication to create and edit teams
Player Management
Requires authentication to manage player rosters
Match Management
Requires authentication to schedule and edit matches
Tournament Overview
Overview of all features and their access requirements