Comparative Analysis of JWT vs Session-Based Authentication in .NET: Performance and Security Evaluation
This solution contains a complete research project implementation comparing JWT and Session-based authentication methods in ASP.NET Core applications.
Academic research project for AP9SI/AE9SI course focusing on:
- Performance comparison of authentication methods
- Statistical analysis with t-tests
- Security characteristics evaluation
- IMRAD paper preparation with real data
AuthApps/
│
├── JwtApp/ # JWT-based authentication web app
├── SessionApp/ # Session-based authentication web app
├── AuthBenchmarks/ # BenchmarkDotNet performance testing
├── LoadTester/ # Concurrent user load testing tool
├── MetricsAnalyzer/ # Statistical analysis & LaTeX export
│
├── Results/ # Auto-generated test results & reports
│ ├── *.csv # Import into Excel
│ ├── *.json # Raw test data
│ ├── *.txt # Human-readable reports
│ └── *.tex # LaTeX tables for Overleaf
│
└── Documentation/
├── RESEARCH_GUIDE.md # Start here! Complete guide
├── QUICK_START_CHECKLIST.md # Step-by-step checklist
└── METHODOLOGY_TEMPLATE.md # Copy-paste for your paper
dotnet build# Microbenchmarks (5-10 minutes)
cd AuthBenchmarks
dotnet run -c Release
# Load testing (20-30 minutes) - in 3 separate terminals:
cd JwtApp && dotnet run
cd SessionApp && dotnet run
cd LoadTester && dotnet runcd MetricsAnalyzer
dotnet runCheck the Results/ folder for:
- ✅ CSV files for Excel graphs
- ✅ LaTeX tables for your paper
- ✅ Statistical analysis reports
- ✅ T-test results with p-values
- Response times (mean, median, std dev, percentiles)
- Throughput (requests per second)
- Memory usage
- Scalability under load (10-500 concurrent users)
- Descriptive statistics
- Welch's t-test results
- P-values for significance testing
- Effect sizes
- LaTeX tables → Copy directly to Overleaf
- CSV data → Create graphs in Excel
- Analysis reports → Reference in your paper
Start here: RESEARCH_GUIDE.md - Comprehensive guide with step-by-step instructions
For your paper: METHODOLOGY_TEMPLATE.md - Ready-to-use text for Methods/Results sections
Checklist: QUICK_START_CHECKLIST.md - Print and check off as you complete tasks
- Framework: ASP.NET Core 9.0 (Razor Pages)
- Authentication: JWT Bearer + Cookie Authentication
- Performance Testing: BenchmarkDotNet 0.15.8
- Statistics: MathNet.Numerics 5.0.0
- Data Export: CsvHelper, System.Text.Json
Your paper should follow IMRAD format:
- Introduction: Background, research question, literature review
- Methods: Implementation, testing methodology, statistical analysis
- Results: Performance data, statistical tests, tables/graphs
- Discussion: Interpretation, implications, limitations
- Conclusion: Summary, recommendations, future work
Templates and examples provided in METHODOLOGY_TEMPLATE.md.
This project provides everything you need:
- ✅ Working implementations (JWT & Session)
- ✅ Automated testing tools
- ✅ Statistical analysis
- ✅ LaTeX table generation
- ✅ Paper templates
- ✅ Methodology documentation
You just need to:
- Run the tests
- Create visualizations from CSV data
- Write your analysis and discussion
- Prepare your presentation
| Feature | JWT | Session |
|---|---|---|
| State | Stateless | Stateful |
| Storage | Client-side token | Server-side session |
| Revocation | Requires blacklist | Immediate |
| Scalability | Horizontal scaling friendly | Needs shared storage |
| Token Size | Larger (~200-500 bytes) | Smaller (~50 bytes) |
Based on typical findings (your results may vary):
- JWT: Higher initial overhead due to cryptographic operations
- Session: Faster validation but requires server state
- Scalability: JWT advantages in distributed systems
- Security: Both secure with proper implementation
- Run tests when computer is idle for accurate results
- Keep apps running during load tests (don't close terminals)
- Use Release configuration for benchmarks (
-c Release) - Backup your Results/ folder before re-running tests
See RESEARCH_GUIDE.md section "Troubleshooting" for common issues and solutions.
For course-specific questions, contact your professor.
For technical issues:
- Check
RESEARCH_GUIDE.md - Verify all projects build:
dotnet build - Check that ports 7275 and 7236 are available
- IMRAD research paper (PDF)
- Presentation slides (10-15 slides)
- Source code (this solution)
- Raw data (CSV files)
- Graphs/visualizations
- Statistical analysis reports
This is an academic research project. Use for educational purposes.
Developed for AP9SI/AE9SI Software Engineering Research course.
Ready to start? Open RESEARCH_GUIDE.md for detailed instructions!
In a hurry? Open QUICK_START_CHECKLIST.md for a step-by-step guide!