PasteTrue is a secure text sharing service built with ASP.NET Core, featuring JWT authentication and password-protected pastes. It allows users to create, manage, and share text snippets with optional password protection.
- 🔐 JWT Authentication
- 👤 User Registration and Login
- 📝 Create and manage text pastes
- 🔐 Create private pastes
- 🔒 Optional password protection for pastes
- 🔍 Retrieve pastes by ID
- 🗑️ Delete own pastes
- 💼 User-specific paste management
- ASP.NET Core
- Entity Framework Core
- Microsoft Identity
- JWT Authentication
- SQLite (can be configured for other databases)
POST /api/Auth/register
Content-Type: application/json
{
"userName": "string",
"email": "string",
"password": "string"
}
POST /api/Auth/login
Content-Type: application/json
{
"userName": "string",
"password": "string"
}
POST /api/Paste/create
Content-Type: application/json
{
"title": "string",
"content": "string",
"password": "string" (optional)
}
POST /api/Paste/getPaste/{id}?password=optional_password
GET /api/Paste/getMyPastes
Authorization: Bearer {token}
DELETE /api/Paste/{id}
Authorization: Bearer {token}
- Clone the repository:
git clone https://github.com/yourusername/PasteTrue.git
- Update the connection string in
appsettings.json
:
{
"ConnectionStrings": {
"DefaultConnection": "Your_Connection_String_Here"
}
}
- Run the application:
dotnet run
- Users register with username, email, and password
- Upon successful registration, users are assigned the "User" role
- Login returns a JWT token used for authenticated requests
- Protected endpoints require a valid JWT token in the Authorization header
- Pastes can be created with or without password protection
- Password-protected pastes require the correct password for access
- Authenticated users can manage their own pastes
- Anonymous users can create and access pastes (with password if required)
- Password hashing for user accounts
- JWT token-based authentication
- Optional password protection for individual pastes
- Role-based authorization
- Input validation and model state checking
This project is licensed under the MIT License - see the LICENSE file for details.